Method: Cl::Cmd::Dsl#opt
- Defined in:
- lib/cl/dsl.rb
#opt(name, description, opts) ⇒ Object
Declares an option
Use this method to declare options a command accepts.
See [this section](/#Options) for a full explanation on each feature supported by command options.
Parameters:
-
name
(String)
—
the option name
-
description
(String)
—
description for the option, shown in the help output
-
opts
(Hash)
—
option options
Options Hash (opts):
-
:alias
(Symbol or Array<Symbol>)
—
alias name(s) for the option
-
:default
(Object)
—
default value for the option
-
:deprecated
(String or Symbol)
—
deprecation message for the option, or if given a Symbol, deprecated alias name
-
:downcase
(Boolean)
—
whether to downcase the option value
-
:upcase
(Boolean)
—
whether to upcase the option value
-
:enum
(Array<Object>)
—
list of acceptable option values
-
:example
(String)
—
example(s) for the option, shown in help output
-
:format
(Regexp)
—
acceptable option value format
-
:internal
(Boolean)
—
whether to hide the option from help output
-
:min
(Numeric)
—
minimum acceptable value
-
:max
(Numeric)
—
maximum acceptable value
-
:see
(String)
—
see also reference (e.g. documentation URL)
-
:type
(Symbol)
—
the option value type (‘:array`, `:string`, `:integer`, `:float`, `:boolean`)
-
:required
(Boolean)
—
whether the option is required
-
:requires
(Array<Symbol> or Symbol)
— default:
an
—
other options required this option depends on
121 122 123 |
# File 'lib/cl/dsl.rb', line 121 def opt(*args, &block) self.opts.define(self, *args, &block) end |