Terminates option parsing. Optional parameter arg
is a string pushed back to be the first non-option argument.
Directs to accept specified class t
. The argument string is passed to the block in which it should be converted to the desired class.
t
Argument class specifier, any object including Class
.
pat
Pattern for argument, defaults to t
if it responds to match.
accept(t, pat, &block)
Heading banner preceding summary.
Release code
Returns version string from program_name
, version and release.
Subject of on_tail
.
Puts option summary into to
and returns to
. Yields each line if a block is given.
to
Output destination, which must have method <<. Defaults to [].
width
Width of left side, defaults to @summary_width.
max
Maximum length allowed for left side, defaults to width
- 1.
indent
Indentation, defaults to @summary_indent.
Creates an option from the given parameters params
. See Parameters for New Options.
The block, if given, is the handler for the created option. When the option is encountered during command-line parsing, the block is called with the argument given for the option, if any. See Option Handlers.
Parses command line arguments argv
in order. When a block is given, each non-option argument is yielded. When optional into
keyword argument is provided, the parsed option values are stored there via []=
method (so it can be Hash
, or OpenStruct
, or other similar object).
Returns the rest of argv
left unparsed.
Same as order
, but removes switches destructively. Non-option arguments remain in argv
.
Parses command line arguments argv
in permutation mode and returns list of non-option arguments. When optional into
keyword argument is provided, the parsed option values are stored there via []=
method (so it can be Hash
, or OpenStruct
, or other similar object).
Same as permute
, but removes switches destructively. Non-option arguments remain in argv
.
Parses environment variable env
or its uppercase with splitting like a shell.
env
defaults to the basename of the program.
Returns additional info.
Initializes a new instance and evaluates the optional block in context of the instance. Arguments args
are passed to new
, see there for description of parameters.
This method is deprecated, its behavior corresponds to the older new
method.
Returns an incremented value of default
according to arg
.