W3cubDocs

/Pony

ArgSpec

[Source]

ArgSpec describes the specification of a positional Arg(ument). They have a name, descr(iption), a typ(e), and a default value when they are not required.

Args always come after a leaf command, and are assigned in their positional order.

class val ArgSpec

Constructors

bool

[Source]

Creates an Arg with a Bool typed value that can be used like <cmd> true to yield an arg value like cmd.arg("opt").bool() == true.

new val bool(
  name': String val,
  descr': String val = "",
  default': (Bool val | None val) = reference)
: ArgSpec val^

Parameters

Returns

string

[Source]

Creates an Arg with a String typed value that can be used like <cmd> filename to yield an arg value cmd.arg("file").string() == "filename".

new val string(
  name': String val,
  descr': String val = "",
  default': (String val | None val) = reference)
: ArgSpec val^

Parameters

Returns

i64

[Source]

Creates an Arg with an I64 typed value that can be used like <cmd> 42 to yield an arg value like cmd.arg("count").i64() == I64(42).

new val i64(
  name': String val,
  descr': String val = "",
  default': (I64 val | None val) = reference)
: ArgSpec val^

Parameters

Returns

u64

[Source]

Creates an Arg with an U64 typed value that can be used like <cmd> 47 to yield an arg value like cmd.arg("count").u64() == U64(47).

new val u64(
  name': String val,
  descr': String val = "",
  default': (U64 val | None val) = reference)
: ArgSpec val^

Parameters

Returns

f64

[Source]

Creates an Arg with a F64 typed value that can be used like <cmd> 1.039 to yield an arg value like cmd.arg("ratio").f64() == F64(1.039).

new val f64(
  name': String val,
  descr': String val = "",
  default': (F64 val | None val) = reference)
: ArgSpec val^

Parameters

Returns

string_seq

[Source]

Creates an Arg with a ReadSeq[String] typed value that can be used like <cmd> file1 file2 file3 to yield a sequence of three strings equivalent to cmd.arg("file").string_seq() (equiv) ["file1"; "file2"; "file3"].

new val string_seq(
  name': String val,
  descr': String val = "")
: ArgSpec val^

Parameters

Returns

Public Functions

name

[Source]

Returns the name of this arg.

fun box name()
: String val

Returns

descr

[Source]

Returns the description for this arg.

fun box descr()
: String val

Returns

required

[Source]

Returns true iff this arg 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 arg.

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

© 2016-2018, The Pony Developers
© 2014-2015, Causality Ltd.
Licensed under the BSD 2-Clause License.
https://stdlib.ponylang.io/cli-ArgSpec