Skip to content

Parameters

NebelFox edited this page Apr 5, 2022 · 3 revisions

Parameter Definition Syntax

Positional

  • Mandatory part - name
  • Optional parts:
    • value type:
      • name:type-name
      • e.g. count:int, price:float
      • defaults to string
      • make sure the type is registered via BoxBuilder.Type("type-name", ...)
    • collective tag: name... or typed variant name:type..., e.g. files..., indices:int...
    • optional tag: [name], e.g. [ratio:float], [alias...]

Of course, all the optional parts can be combined, e.g. count:int, [optional-names...]

Note. The collective tag results into array of parameter type instances.
e.g. name... -> string[], digits:int... -> int[].
So make sure you retrieve it property, e.g. (int[])context("digits")

Switch

  • --switch-name
  • e.g. --verbose, --debug, --dry-run.
  • results into bool value - true if specified, false if omitted.

Option

  • a switch, followed by a positional
  • e.g. --output log-file, --exclude values:int...
  • default value
    • is optional, and is null if omitted
    • --option param=default-value
    • is set as the option value in Context, if the option was completely omitted in command invocation string
    • is parsed via option parameter's type once during box build
    • is null if not specified
Clone this wiki locally