class ref Options is Iterator[((String val , (None val | String val | I64 val | U64 val | F64 val)) | ParseError ref | None val)] ref
new ref create( args: Array[String val] box, fatal: Bool val = true) : Options ref^
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
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
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
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)
Strips accepted options from the copied array of command line arguments.
fun ref _strip( opt: _Option ref, matched: String ref, start: ISize val, finish: ISize val) : None val
Selects an option from the configuration depending on the current command line argument.
fun ref _select( candidate: String ref, start: ISize val, offset: ISize val, finish: ISize val) : (_Option ref | ParseError ref)
Skips all non-options. Returns true if a named option has been found, false otherwise.
fun ref _skip() : Bool val
Verifies whether a parsed option from the command line is well-formed. That is, checking whether required or optional arguments are supplied. Returns a ParsedOption on success, a ParseError otherwise.
fun ref _verify( opt: _Option ref, combined: Bool val) : ((String val , (None val | String val | I64 val | U64 val | F64 val)) | ParseError ref)
© 2016-2018, The Pony Developers
© 2014-2015, Causality Ltd.
Licensed under the BSD 2-Clause License.
https://stdlib.ponylang.io/options-Options