struct

Kebab::Schema::Command

Inherits Struct < Value < Object

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)
Source

Instance methods

arguments

The command's positional arguments in declaration order.

Source
has_options?

true if the command declares any options of its own (the synthetic --help does not count). Drives [options] in the usage line.

Source
name

The command's own name, the last segment of path.

Source
options

Every option the command accepts, including the synthetic --help.

Source
path

Path of command names from the binary down to this command (e.g. ["tasks", "add"]).

Source
requires_subcommand?

true if a subcommand must be supplied (a bare invocation errors rather than printing help).

Source
subcommands

Child commands, recursively. Empty for a leaf command.

Source
summary

The summary shown in help.

Source
usage

The usage line for the command, derived from its shape.

Source