Results for: "OptionParser"

See OptionParser.accept.

Creates the summary table, passing each line to the block (without newline). The arguments args are passed along to the summarize method which is called on every option.

Pushes back erred argument(s) to argv.

Returns error reason. Override this for I18N.

Parses self destructively in order and returns self containing the rest arguments left unparsed.

Parses self destructively in permutation mode and returns self containing the rest arguments left unparsed.

No documentation available
No documentation available
No documentation available

Parses arg and returns rest of arg and matched portion to the argument pattern. Yields when the pattern doesn’t match substring.

Iterates over each option, passing the option to the block.

Program name to be emitted in error message and default banner, defaults to $0.

No documentation available

Returns option summary list.

Creates an OptionParser::Switch from the parameters. The parsed argument value is passed to the given block, where it can be processed.

See at the beginning of OptionParser for some full examples.

opts can include the following elements:

Argument style:

One of the following:

:NONE, :REQUIRED, :OPTIONAL
Argument pattern:

Acceptable option argument format, must be pre-defined with OptionParser.accept or OptionParser#accept, or Regexp. This can appear once or assigned as String if not present, otherwise causes an ArgumentError. Examples:

Float, Time, Array
Possible argument values:

Hash or Array.

[:text, :binary, :auto]
%w[iso-2022-jp shift_jis euc-jp utf8 binary]
{ "jis" => "iso-2022-jp", "sjis" => "shift_jis" }
Long style switch:

Specifies a long style switch which takes a mandatory, optional or no argument. It’s a string of the following form:

"--switch=MANDATORY" or "--switch MANDATORY"
"--switch[=OPTIONAL]"
"--switch"
Short style switch:

Specifies short style switch which takes a mandatory, optional or no argument. It’s a string of the following form:

"-xMANDATORY"
"-x[OPTIONAL]"
"-x"

There is also a special form which matches character range (not full set of regular expression):

"-[a-z]MANDATORY"
"-[a-z][OPTIONAL]"
"-[a-z]"
Argument style and description:

Instead of specifying mandatory or optional arguments directly in the switch parameter, this separate parameter can be used.

"=MANDATORY"
"=[OPTIONAL]"
Description:

Description string for the option.

"Run verbosely"
Handler:

Handler for the parsed argument value. Either give a block or pass a Proc or Method as an argument.

No documentation available
No documentation available

Parses argument, converts and returns arg, block and result of conversion. Yields at semi-error condition instead of raising an exception.

No documentation available
No documentation available

Raises an exception if any arguments given.

Raises an exception if argument is not present.

Parses argument if given, or uses default value.

Returns nil if argument is not present or begins with ‘-’.

Guesses argument style from arg. Returns corresponding OptionParser::Switch class (OptionalArgument, etc.).

Search took: 5ms  ·  Total Results: 4252