Options

[Source]

class ref Options is
  Iterator[((String val , (None val | String val | I64 val | U64 val | F64 val)) | ParseError ref | None val)] ref

Implements

Constructors

create

[Source]

new ref create(
  args: Array[String val] box,
  fatal: Bool val = true)
: Options ref^

Parameters

Returns

Public Functions

add

[Source]

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

Returns

remaining

[Source]

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

[Source]

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

next

[Source]

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