Opal::CLI::Command
Represents a command or subcommand node in the CLI hierarchy.
Constructors
Instance methods
aliases
Sourceallow_unknown_options(allow : Bool = true) : self
Allows unrecognized options or flags to pass through without parsing errors
allow_unknown_options?
Sourcearg(name : Symbol, description : String = "", required : Bool = false, default : String | Nil = nil, type : Symbol = :string, multiple : Bool = false, choices : Array(String) | Nil = nil, value_name : String | Nil = nil) : self
Ergonomic shorthand for argument
argument(name : Symbol, description : String = "", required : Bool = false, default : String | Nil = nil, type : Symbol = :string, multiple : Bool = false, choices : Array(String) | Nil = nil, value_name : String | Nil = nil) : self
Defines a positional argument
arguments
Sourcecategory
SourceDefines a subcommand without a block
Defines a subcommand with a configuration block
description
Sourceexamples
Sourceflag(name : Symbol, long : String, short : String | Nil = nil, description : String = "", default : Bool = false, global : Bool = false) : self
Defines a boolean flag (e.g. -q, --quiet or unified "-q, --quiet")
Groups enclosed option/flag definitions into a named category
header_text
Sourcehelp_handler
SourceFormats help screen for this command
name
Sourceopt(name : Symbol, spec : String, description : String = "", type : Symbol | Nil = nil, default : OptionValue = nil, required : Bool = false, global : Bool = false, choices : Array(String) | Nil = nil, env_var : String | Nil = nil, group : String | Nil = nil) : self
Shorthand for option with unified spec string like "-d, --delimiter=CHAR"
option(name : Symbol, long : String, short : String | Nil = nil, description : String = "", type : Symbol = :string, default : OptionValue = nil, required : Bool = false, global : Bool = false, choices : Array(String) | Nil = nil, env_var : String | Nil = nil) : self
Defines a valued option (e.g. -e src/main.cr, --entry=src/main.cr or unified "-e, --entry=DIR")
options
Sourceparent
Sourceparent=(parent : Command | Nil)
SourceAdds a custom help section (e.g. PIPELINE COMPOSITION)
sections
Sourcesubcommands
Sourcesummary
Sourcetitle
Source