Options
class ref Options is Iterator[((String val , (None val | String val | I64 val | U64 val | F64 val)) | ParseError ref | None val)] ref
Implements
- Iterator[((String val , (None val | String val | I64 val | U64 val | F64 val)) | ParseError ref | None val)] ref
Constructors
create
new ref create( args: Array[String val] box, fatal: Bool val = true) : Options ref^
Parameters
Returns
- Options ref^
Public Functions
add
Adds a new named option to the parser configuration.
fun ref add( long: String val, short: (None val | String val) = reference, arg: (None val | StringArgument val | I64Argument val | U64Argument val | F64Argument val) = reference, mode: (Required val | Optional val) = reference) : Options ref
Parameters
- long: String val
- short: (None val | String val) = reference
- arg: (None val | StringArgument val | I64Argument val | U64Argument val | F64Argument val) = reference
- mode: (Required val | Optional val) = reference
Returns
- Options ref
remaining
Returns all unprocessed command line arguments. After parsing all options, this will only include positional arguments, potentially unrecognised and ambiguous options and invalid arguments.
fun ref remaining() : Array[String ref] ref
Returns
has_next
Parsing options is done if either an error occurs and fatal error reporting is turned on, or if all command line arguments have been processed.
fun box has_next() : Bool val
Returns
- Bool val
next
Skips all positional arguments and attemps to match named options. Returns a ParsedOption on success, a ParseError on error, or None if no named options are found.
fun ref next() : ((String val , (None val | String val | I64 val | U64 val | F64 val)) | ParseError ref | None val)
Returns
© 2016-2020, The Pony Developers
© 2014-2015, Causality Ltd.
Licensed under the BSD 2-Clause License.
https://stdlib.ponylang.io/options-Options