The base of command classes.
Your application should not directly inherit this class. Instead, use Command or Supercommand.
Class methods
disable_help_on_parsing_error!
Disables printing a help message when a parsing error occurs.
Sourcegenerate_bash_completion
Generates a bash completion script.
Sourcegenerate_zsh_completion(functional :
Bool = true)
Generates a zsh completion script.
SourceSets the command version.
SourceInstance methods
args
Returns option and argument values (an OptionModel instance).
This method is the same as #options.
Sourceerror!(message :
String |
Nil = nil, code :
Int32 |
Nil = nil, help :
Bool = false, indent = 2)
Exits the command with an error status.
Sourceexit!(message :
String |
Nil = nil, error :
Bool = false, code :
Int32 |
Nil = nil, help = false, indent = 2)
Sourcehelp!(message :
String |
Nil = nil, error :
Bool |
Nil = nil, code :
Int32 |
Nil = nil, indent = 2)
Prints a help message and exits the command.
Sourceio
Returns a named IO container.
Sourcenameless_args
Returns an array of nameless argument values.
This method is a short form of #args.nameless_args.
Sourceoptions
Returns option and argument values (an OptionModel instance).
This method is the same as #args.
Sourceprint(*args)
Invokes the :out IO'S print method.
Sourceputs(*args)
Invokes the :out IO's puts method.
Sourcerun
Runs the command.
This method is an entrypoint for running a command.
Subclasses must override this method.
Sourceunparsed_args
Returns an array of unparsed argument values.
This method is a short form of #args.unparsed_args.
Sourceversion
Returns the command version.
Sourceversion!
Prints a version string and exits the command.
Sourceversion?
Returns the command version.
Returns nil, if no version is set.
SourceMacros
define_callback_group(name, proc_type = ::
Proc(::
Nil))
Defines a new callback group.
This macro is automatically defined by the Crystal Callback library.
Sourceinherit_callback_group(name, proc_type = ::
Proc(::
Nil))
Inherits an existing callback group that is defined in its ancestor class.
This macro is automatically defined by the Crystal Callback library.
Sourcereplacer_command(klass)
Replaces this command with the klass command.
Source