Parsing command-line arguments


The command-line.parser vocabulary can be used to parse command-line arguments.

A sequence of option instances is used to control how the arguments are parsed and is typically passed to the following words from a command-line program:
with-options ( ... options quot: ( ... -- ... ) -- ... )

parse-options ( options -- arguments )

(parse-options) ( options command-line -- arguments )


Some variables control certain aspects of the parsing:
default-help?A boolean value controlling if a --help option is added.
allow-abbrev?A boolean value controlling if abbreviations are allowed for options.
program-nameAn optional program name, or it will be inferred from the script or launched binary name.
program-prologSome text to include in the help display before the options.
program-epilogSome text to include in the help display after the options.

In the case that you want to pass an option lookalike as a positional argument, for example --foo then you can pass it after -- to indicate that the remaining arguments should be interpreted as positional arguments.