the name of the program, for the usage message
force a more compact usage message
width of the output; used when wrapping the usage message
optional message to issue before the usage message (e.g., a copyright and/or version string)
optional message to issue after the usage message
If true
(the default), the options are sorted
alphabetically in the usage output. If false
, they
are displayed in the order they were created.
Define a flag option.
Define a flag option. Flag options take no value parameters. Instead, a flag option is simply present or absent. Typically, flag options are associated with boolean value, though Argot will permit you to associate them with any type you choose.
Flag options permit you to segregate the option names into on
names and off names. With boolean flag options, the on names
set the value to true
, and the off names set the value to
values. With typed flag options, what happens depends on the
conversion function. Whatever the conversion function returns gets
stored as the option's value.
Flag conversion functions receive a boolean parameter, indicating
whether an on option was seen (true
) or an off option was
seen (false
). The built-in conversion functions for boolean flags
simply return the value of the boolean, which is then stored in the
(Boolean) flag option's value. However, it's perfectly reasonable
to have flag options with other types. For instance, one could easily
define a "Verbosity" flag option of type Int
, where each on
option increments the verbosity level and each off option decrements
the value.
the type of the option's value, which will be stored in
the FlagOption
object's value
field.
the name for the option that enables (turns on) the option. The name can be a single character (thus, "v" corresponds to "-v") or multiple characters ("verbose" for "--verbose").
a description for the option, for the usage message
a function that will convert a boolean on/off value
to type T
. The function should throw
ArgotConversionException
on conversion error.
For a boolean flag option , the implicit functions in
the ArgotConverters
module are often suitable.
the FlagOption
object that will contain the
parsed value, as an Option[T]
in the value
field.
Define a flag option.
Define a flag option. Flag options take no value parameters. Instead, a flag option is simply present or absent. Typically, flag options are associated with boolean value, though Argot will permit you to associate them with any type you choose.
Flag options permit you to segregate the option names into on
names and off names. With boolean flag options, the on names
set the value to true
, and the off names set the value to
values. With typed flag options, what happens depends on the
conversion function. Whatever the conversion function returns gets
stored as the option's value.
Flag conversion functions receive a boolean parameter, indicating
whether an on option was seen (true
) or an off option was
seen (false
). The built-in conversion functions for boolean flags
simply return the value of the boolean, which is then stored in the
(Boolean) flag option's value. However, it's perfectly reasonable
to have flag options with other types. For instance, one could easily
define a "Verbosity" flag option of type Int
, where each on
option increments the verbosity level and each off option decrements
the value.
the type of the option's value, which will be stored in
the FlagOption
object's value
field.
the names for the option that enable (turn on) the option. Each name can be a single character (thus, "v" corresponds to "-v") or multiple characters ("verbose" for "--verbose").
a description for the option, for the usage message
a function that will convert a boolean on/off value
to type T
. The function should throw
ArgotConversionException
on conversion error.
For a boolean flag option , the implicit functions in
the ArgotConverters
module are often suitable.
the FlagOption
object that will contain the
parsed value, as an Option[T]
in the value
field.
Define a flag option.
Define a flag option. Flag options take no value parameters. Instead, a flag option is simply present or absent. Typically, flag options are associated with boolean value, though Argot will permit you to associate them with any type you choose.
Flag options permit you to segregate the option names into on
names and off names. With boolean flag options, the on names
set the value to true
, and the off names set the value to
values. With typed flag options, what happens depends on the
conversion function. Whatever the conversion function returns gets
stored as the option's value.
Flag conversion functions receive a boolean parameter, indicating
whether an on option was seen (true
) or an off option was
seen (false
). The built-in conversion functions for boolean flags
simply return the value of the boolean, which is then stored in the
(Boolean) flag option's value. However, it's perfectly reasonable
to have flag options with other types. For instance, one could easily
define a "Verbosity" flag option of type Int
, where each on
option increments the verbosity level and each off option decrements
the value.
the type of the option's value, which will be stored in
the FlagOption
object's value
field.
the names for the option that enable (turn on) the option. Each name can be a single character (thus, "v" corresponds to "-v") or multiple characters ("verbose" for "--verbose").
the names for the option that disable (turn off) the option. Each name can be a single character (thus, "v" corresponds to "-v") or multiple characters ("verbose" for "--verbose").
a description for the option, for the usage message
a function that will convert a boolean on/off value
to type T
. The function should throw
ArgotConversionException
on conversion error.
For a boolean flag option , the implicit functions in
the ArgotConverters
module are often suitable.
the FlagOption
object that will contain the
parsed value, as an Option[T]
in the value
field.
Define an option that takes a sequence of values of type T
.
Define an option that takes a sequence of values of type T
. Each
invocation of the option on the command line contributes a new value
to the sequence. This short-hand method provides only one option
name, as opposed to a list of option names.
the type of the option's value, which added to the
the MultiValueOption
object's value
sequence field.
the name for the option. The name can be a single character (thus, "v" corresponds to "-v") or multiple characters ("verbose" for "--verbose").
a name to use for the associated value in the generated usage message
a description for the option, for the usage message
a function that will convert a string value into
type T
. The function should throw
ArgotConversionException
on conversion error.
For common types, the implicit functions in the
ArgotConverters
module are often suitable.
the MultiValueOption
object that will contain the
parsed value(s), as a Seq[T]
in the value
field.
Define an option that takes a sequence of values of type T
.
Define an option that takes a sequence of values of type T
. Each
invocation of the option on the command line contributes a new value
to the sequence.
the type of the option's value, which added to the
the MultiValueOption
object's value
sequence field.
the list of names for the option. Each name can be a single character (thus, "v" corresponds to "-v") or multiple characters ("verbose" for "--verbose").
a name to use for the associated value in the generated usage message
a description for the option, for the usage message
a function that will convert a string value into
type T
. The function should throw
ArgotConversionException
on conversion error.
For common types, the implicit functions in the
ArgotConverters
module are often suitable.
the MultiValueOption
object that will contain the
parsed value(s), as a Seq[T]
in the value
field.
Define a positional parameter that can occur multiple times.
Define a positional parameter that can occur multiple times. Only one such parameter can exist, and it must be the last parameter in the command line. See the class documentation for complete details.
the placeholder name for the parameter's value, for the usage message
textual description of the parameter
whether or not the parameter is optional. Only one parameter may be optional, and it must be the last one.
a function that will convert a string value for
the parameter to an appropriate value of type T
.
The function should throw ArgotConversionException
on conversion error.
the MultiValueParameter
object will contain the parsed
values (as a Seq[T]
in the value
field).
Define an option that takes a single value of type T
.
Define an option that takes a single value of type T
. This short-hand
method provides only one option name, as opposed to a list of option
names.
the type of the option's value, which will be stored in
the SingleValueOption
object's value
field.
the name for the option. The name can be a single character (thus, "v" corresponds to "-v") or multiple characters ("verbose" for "--verbose").
a name to use for the associated value in the generated usage message
a description for the option, for the usage message
a function that will convert a string value into
type T
. The function should throw
ArgotConversionException
on conversion error.
For common types, the implicit functions in the
ArgotConverters
module are often suitable.
the SingleValueOption
object that will contain the
parsed value, as an Option[T]
in the value
field.
Define an option that takes a single value of type T
.
Define an option that takes a single value of type T
.
the type of the option's value, which will be stored in
the SingleValueOption
object's value
field.
the list of names for the option. Each name can be a single character (thus, "v" corresponds to "-v") or multiple characters ("verbose" for "--verbose").
a name to use for the associated value in the generated usage message
a description for the option, for the usage message
a function that will convert a string value into
type T
. The function should throw
ArgotConversionException
on conversion error.
For common types, the implicit functions in the
ArgotConverters
module are often suitable.
the SingleValueOption
object that will contain the
parsed value, as an Option[T]
in the value
field.
Define a positional parameter that has a single value.
Define a positional parameter that has a single value. Positional
parameters are parsed from the command line in the order they are
added to the ArgotParser
. See the class documentation for complete
details.
the placeholder name for the parameter's value, for the usage message
textual description of the parameter
whether or not the parameter is optional. Only one parameter may be optional, and it must be the last one.
a function that will convert a string value for
the parameter to an appropriate value of type T
.
The function should throw ArgotConversionException
on conversion error.
the SingleValueParameter
object will contain the parsed
value (as an Option[T]
in the value
field).
Parse the specified array of command-line arguments, according to the parser's specification.
Parse the specified array of command-line arguments, according to the parser's specification. A successful parse sets the various value objects returned by the specification methods.
the command line parameters
some other kind of fatal error
ArgotUsageExceptionuser error on the command line; the exception contains the usage message
Parse the specified array of command-line arguments, according to the parser's specification.
Parse the specified array of command-line arguments, according to the parser's specification. A successful parse sets the various value objects returned by the specification methods.
the command line parameters
some other kind of fatal error
ArgotUsageExceptionuser error on the command line; the exception contains the usage message
Resets the internal state of all contained options and parameters, undoing the effects of any parse operation.
Throws an ArgotUsageException
containing the usage string.
Throws an ArgotUsageException
containing the usage string.
optional message to prefix the usage string.
unconditionally
Throws an ArgotUsageException
containing the usage string.
Throws an ArgotUsageException
containing the usage string.
unconditionally
Generate the usage string.
Generate the usage string. This string is automatically included in
any thrown ArgotUsageException
.
optional message to prefix the usage string.
the usage string, wrapped appropriately.
ArgotParser
is a command-line parser, with support for single-value and multi-value options, single-value and multi-value parameters, typed value, custom conversions (with suitable defaults), and extensibility.An
ArgotParser
embodies a representation of the command line: its expected options and their value types, the expected positional parameters and their value types, the name of the program, and other values.For complete details, see the Argot web site (linked below).
the Argot web site