abstract class Cling::MainCommand
- Cling::MainCommand
- Cling::Command
- Reference
- Object
Defined in:
cling/helper.crInstance Method Summary
-
#pre_run(arguments : Cling::Arguments, options : Cling::Options) : Bool
A hook method to run once the command/subcommands, arguments and options have been parsed.
-
#setup : Nil
An abstract method that should define information about the command such as the name, aliases, arguments, options, etc.
Instance methods inherited from class Cling::Command
add_alias(name : String) : Nil
add_alias,
add_aliases(*names : String) : Nil
add_aliases,
add_argument(name : String, *, description : String | Nil = nil, required : Bool = false, multiple : Bool = false) : Nil
add_argument,
add_command(command : Command) : Nil
add_command,
add_commands(*commands : Command) : Nil
add_commands,
add_option(short : Char, long : String, *, description : String | Nil = nil, required : Bool = false, type : Option::Type = :none, default : Value::Type = nil) : Niladd_option(long : String, *, description : String | Nil = nil, required : Bool = false, type : Option::Type = :none, default : Value::Type = nil) : Nil add_option, add_usage(usage : String) : Nil add_usage, aliases : Set(String) aliases, arguments : Hash(String, Argument) arguments, children : Hash(String, Command) children, description : String | Nil description, description=(description : String | Nil) description=, execute(input : String | Array(String), *, parser : Parser | Nil = nil) : Nil execute, footer : String | Nil footer, footer=(footer : String | Nil) footer=, header : String | Nil header, header=(header : String | Nil) header=, help_template : String help_template, hidden=(hidden : Bool) hidden=, hidden? : Bool hidden?, inherit_borders=(inherit_borders : Bool) inherit_borders=, inherit_borders? : Bool inherit_borders?, inherit_options=(inherit_options : Bool) inherit_options=, inherit_options? : Bool inherit_options?, inherit_streams=(inherit_streams : Bool) inherit_streams=, inherit_streams? : Bool inherit_streams?, is?(name : String) : Bool is?, name : String name, name=(name : String) name=, on_error(ex : Exception) on_error, on_missing_arguments(arguments : Array(String)) on_missing_arguments, on_missing_options(options : Array(String)) on_missing_options, on_unknown_arguments(arguments : Array(String)) on_unknown_arguments, on_unknown_options(options : Array(String)) on_unknown_options, options : Hash(String, Option) options, parent : Command | Nil parent, parent=(parent : Command | Nil) parent=, post_run(arguments : Arguments, options : Options) : Nil post_run, pre_run(arguments : Arguments, options : Options) : Bool | Nil pre_run, run(arguments : Arguments, options : Options) : Nil run, setup : Nil setup, stderr : IO stderr, stderr=(stderr : IO) stderr=, stdin : IO stdin, stdin=(stdin : IO) stdin=, stdout : IO stdout, stdout=(stdout : IO) stdout=, summary : String | Nil summary, summary=(summary : String | Nil) summary=, usage : Array(String) usage
Constructor methods inherited from class Cling::Command
new(*, aliases : Set(String) | Nil = nil, usage : Array(String) | Nil = nil, header : String | Nil = nil, summary : String | Nil = nil, description : String | Nil = nil, footer : String | Nil = nil, parent : Command | Nil = nil, children : Array(Command) | Nil = nil, arguments : Hash(String, Argument) | Nil = nil, options : Hash(String, Option) | Nil = nil, hidden : Bool = false, inherit_borders : Bool = false, inherit_options : Bool = false, inherit_streams : Bool = false, stdin : IO = STDIN, stdout : IO = STDOUT, stderr : IO = STDERR)
new
Instance Method Detail
A hook method to run once the command/subcommands, arguments and options have been parsed.
This has access to the parsed arguments and options from the command line. This is useful if
you want to implement checks for specific flags outside of the main run
method, such as
-v
/--version
flags or -h
/--help
flags.
Accepts a Bool
or nil
argument as a return to specify whether the command should continue
to run once finished (true
or nil
to continue, false
to stop).
An abstract method that should define information about the command such as the name, aliases, arguments, options, etc. The command name is required for all commands, all other values are optional including the help message.