Kebab::Option
Marks a field as an option, parsed from a --long or -s flag.
A Bool field is a flag that takes no value. Any other type takes one value
per occurrence, converted to the field's type. String, the integer and
float types, and enums are built in. Other types need a converter.
@[Kebab::Option(short: 'a', description: "Clock in at a past time")]
getter at : String?
@[Kebab::Option(short: 'v', count: true, description: "Increase verbosity")]
getter verbosity : Int32 = 0
Available fields:
- long (
String): the--name. Defaults to the field name with underscores as dashes. - short (
Char): a single-letter-xalias. - description (
String): the help text for the option. - converter (
Type): a type or module withself.convert(input : String) : T | Kebab::Convert::Failure, for types kebab does not convert on its own. SeeKebab::Convert. - global (
Bool): iftrue, the option is recognised anywhere in the command's subtree, including after subcommands (by defaultfalse). - arity (
Int | Range): how many values one occurrence consumes, on anArray(T)field.2takes a fixed pair,1..takes one or more (by default one, or the size of aTuple). - value_names (
Tuple(String, ...)): the<name>placeholders shown for the values in help. - count (
Bool): iftrue, an integer field counts its occurrences like-vvv, saturating at the type's maximum (by defaultfalse).