Class | Slop::Option |
In: |
lib/slop.rb
|
Parent: | Struct.new(:short_flag, :long_flag, :description, :tail, :match, :help, :required, :forced, :count) |
Each option specified in `Slop#opt` creates an instance of this class
@param [Slop] slop The Slop object this Option belongs to
@param [String, to_s] short The short flag representing this Option
without prefix (ie: `a`)
@param [String, to_s] long The long flag representing this Option
without the prefix (ie: `foo`)
@param [String] description This options description
@param [Boolean] argument True if this option takes an argument
@option options [Boolean] :optional
* When true, this option takes an optional argument, ie an argument does not **have** to be supplied.
@option options [Boolean] :argument
* True if this option takes an argument.
@option options [Object] :default
* The default value for this option when no argument is given
@option options [Proc, call] :callback
* The callback object, used instead of passing a block to this option
@option options [String, to_s] :delimiter (’,’)
* A delimiter string when processing this option as a list
@option options [Integer] :limit (0)
* A limit, used when processing this option as a list
@option options [Boolean] :tail (false)
* When true, this option will be grouped at the bottom of the help text instead of in order of processing
@option options [Regexp] :match
* A regular expression this option should match
@option options [String, to_s] :unless
* Used by `omit_exec` for omitting execution of this options callback if another option exists
@option options [Boolean, String] :help (true)
* If this option is a string, it'll be appended to the long flag help text (before the description). When false, no help information will be displayed for this option
@option options [Boolean] :required (false)
* When true, this option is considered mandatory. That is, when not supplied, Slop will raise a `MissingOptionError`
Set this options argument value.
If this options argument type is expected to be an Array, this method will split the value and concat elements into the original argument value
@param [Object] value The value to set this options argument to
Force an argument value, used when the desired argument value is negative (false or nil)
@param [Object] value
@param [Array] items The original array of objects passed to `Slop.new` @return [Boolean] true if this options `:unless` argument exists
inside *items*