Option

annotation class Option(val names: Array<String> = [], val help: String = "", val default: String = NO_DEFAULT)

Declares a value-bearing named option on a Command constructor parameter.

The parameter's type determines the converter (String, Int, Long, Double, Boolean, an enum, or List<T> of those for a repeatable option). Optionality:

  • a non-nullable type with no default is required;

  • a nullable type is optional, resolving to null when absent;

  • a default is optional, parsed via the parameter's converter when the option is absent.

Parameters

names

the option's names, primary first (for example ["--port", "-p"]).

help

help text for --help.

default

the default value as a string; leave unset to mean "no default".

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard