optio
Translation status: 简体中文 reader-locale proof. Code fences render through the zh-Hans pipeline; prose is canonical Latin.
Declares a CLI option annotation.
Syntax: @ optio <binding> [brevis \"x\"] [longum \"name\"] [typus <type>] [descriptio \"...\"] [ubique] [vel <default>]
Category#
cli
Related#
Examples#
radix/corpus/annotation-sugar/optio-braced.fab (canonical · annotation)#
Braced canonical @ optio CLI option record.
# =============================================================================
# optio — Braced canonical @ optio CLI option record.
# =============================================================================
#
# What this teaches:
# • Braced option annotation — `@ optio { binding = NAME, … }` configures a
# CLI option with named fields
# • Option fields — binding, brevis, longum, typus, descriptio, and ubique
# control how the option is parsed and documented
#
# Common mistakes:
# • omitting required fields like `binding` or `longum` in `@ optio` braced records; boolean flags need `typus bivalens`
#
# See also: optio, cli, annotation-sugar
# =============================================================================
# Braced @ optio — canonical option record
#
# TARGET: annotation-sugar stage 2
# PAIR: sugar `@ optio NAME brevis \"x\" ...` (see optio/optio.fab)
@ cli { nomen = "optio-braced-smoke" }
@ option {
binding = verbose,
brevis = "v",
longum = "verbose",
typus = bool,
descriptio = "Verbose mode",
ubique = true,
}
main args args { }radix/corpus/optio/optio.fab (canonical · keyword)#
Declares a CLI option annotation.
# =============================================================================
# optio — Declares a CLI option annotation.
# =============================================================================
#
# What this teaches:
# • CLI options — `@optio` declares named flags (short and long forms) for CLI subcommands.
# • Option metadata — Each option specifies binding, type, description, and optional default values.
#
# Common mistakes:
# • Declaring a boolean optio without at least one of brevis or longum — boolean flags need a flag form to be usable.
#
# See also: operandus, cli, imperium, ubique, vel
# =============================================================================
# optio — CLI option annotation
#
# GRAMMAR:
# annotation :← '@' 'optio' optionSpec
#
# EXPECTED OUTPUT:
# No incipit — declaration or test-runner surface only.
#
# BACKEND:
# declaration-only CLI metadata (whitelist: optio/optio.fab).
#
@ cli "optio-smoke"
@ option verbose short "v" long "verbose" type bool description "Verbose mode"
@ option count long "count" type int description "Repeat count"
main args args {
}