Skip to content

OptionSpec

[Source]

OptionSpec describes the specification of a named Option. They have a name, descr(iption), a short-name, a typ(e), and a default value when they are not required.

Options can be placed anywhere before or after commands, and can be thought of as named arguments.

class val OptionSpec

Constructors

bool

[Source]

Creates an Option with a Bool typed value that can be used like --opt or -O or --opt=true or -O=true to yield an option value like cmd.option("opt").bool() == true.

new val bool(
  name': String val,
  descr': String val = seq,
  short': (U8 val | None val) = seq,
  default': (Bool val | None val) = seq)
: OptionSpec val^

Parameters

Returns


string

[Source]

Creates an Option with a String typed value that can be used like --file=dir/filename or -F=dir/filename or -Fdir/filename to yield an option value like cmd.option("file").string() == "dir/filename".

new val string(
  name': String val,
  descr': String val = seq,
  short': (U8 val | None val) = seq,
  default': (String val | None val) = seq)
: OptionSpec val^

Parameters

Returns


i64

[Source]

Creates an Option with an I64 typed value that can be used like --count=42 -C=42 to yield an option value like cmd.option("count").i64() == I64(42).

new val i64(
  name': String val,
  descr': String val = seq,
  short': (U8 val | None val) = seq,
  default': (I64 val | None val) = seq)
: OptionSpec val^

Parameters

Returns


u64

[Source]

Creates an Option with an U64 typed value that can be used like --count=47 -C=47 to yield an option value like cmd.option("count").u64() == U64(47).

new val u64(
  name': String val,
  descr': String val = seq,
  short': (U8 val | None val) = seq,
  default': (U64 val | None val) = seq)
: OptionSpec val^

Parameters

Returns


f64

[Source]

Creates an Option with a F64 typed value that can be used like --ratio=1.039 or -R=1.039 to yield an option value like cmd.option("ratio").f64() == F64(1.039).

new val f64(
  name': String val,
  descr': String val = seq,
  short': (U8 val | None val) = seq,
  default': (F64 val | None val) = seq)
: OptionSpec val^

Parameters

Returns


string_seq

[Source]

Creates an Option with a ReadSeq[String] typed value that can be used like --files=file1 --files=files2 --files=files2 to yield a sequence of three strings equivalent to cmd.option("ratio").string_seq() (equiv) ["file1"; "file2"; "file3"].

new val string_seq(
  name': String val,
  descr': String val = seq,
  short': (U8 val | None val) = seq)
: OptionSpec val^

Parameters

Returns


Public Functions

name

[Source]

Returns the name of this option.

fun box name()
: String val

Returns


descr

[Source]

Returns the description for this option.

fun box descr()
: String val

Returns


required

[Source]

Returns true iff this option is required to be present in the command line.

fun box required()
: Bool val

Returns


help_string

[Source]

Returns a formated help string for this option.

fun box help_string()
: String val

Returns


deb_string

[Source]

fun box deb_string()
: String val

Returns


Private Functions

_init

[Source]

fun tag _init(
  typ': _ValueType val,
  default': (Bool val | String val | I64 val | 
    U64 val | F64 val | _StringSeq val | 
    None val))
: (_ValueType val , (Bool val | String val | I64 val | 
    U64 val | F64 val | _StringSeq val) , Bool val)

Parameters

Returns


_typ_p

[Source]

fun box _typ_p()
: _ValueType val

Returns


_default_p

[Source]

fun box _default_p()
: (Bool val | String val | I64 val | 
    U64 val | F64 val | _StringSeq val)

Returns


_requires_arg

[Source]

fun box _requires_arg()
: Bool val

Returns


_default_arg

[Source]

fun box _default_arg()
: (Bool val | String val | I64 val | 
    U64 val | F64 val | _StringSeq val)

Returns


_has_short

[Source]

fun box _has_short(
  sh: U8 val)
: Bool val

Parameters

  • sh: U8 val

Returns