The structure of one command, built from the command struct at compile
time. subcommands holds the same type for each child.
options includes the synthetic --help, so it is what help and
completion list. has_options? counts only declared options, so it is
what drives [options] in the usage line.
Constructors
new(*, path :
Array(
String), summary :
String, options :
Array(
Option) = [] of
Option, arguments :
Array(
Argument) = [] of
Argument, subcommands :
Array(
Command) = [] of
Command, has_options :
Bool = false, requires_subcommand :
Bool = false)
SourceInstance methods
arguments
The command's positional arguments in declaration order.
Sourcehas_options?
true if the command declares any options of its own (the synthetic
--help does not count). Drives [options] in the usage line.
Sourcename
The command's own name, the last segment of path.
Sourceoptions
Every option the command accepts, including the synthetic --help.
Sourcepath
Path of command names from the binary down to this command
(e.g. ["tasks", "add"]).
Sourcerequires_subcommand?
true if a subcommand must be supplied (a bare invocation errors
rather than printing help).
Sourcesubcommands
Child commands, recursively. Empty for a leaf command.
Sourcesummary
The summary shown in help.
Sourceusage
The usage line for the command, derived from its shape.
Source