選項
Translation status: 繁體中文 reader-locale proof. Term names and code fences follow the zh-Hant pack; supporting prose may still be English.
Declares a CLI option annotation.
Syntax: @ 選項 <binding> [簡 \"x\"] [longum \"name\"] [typus <type>] [descriptio \"...\"] [ubique] [vel <default>]
Category#
cli
Related#
Examples#
radix/corpus/annotation-sugar/optio-braced.fab (canonical · annotation)#
Braced canonical @ 選項 CLI option record.
# =============================================================================
# 選項 — Braced canonical @ 選項 CLI option record.
# =============================================================================
#
# What this teaches:
# • Braced option annotation — `@ 選項 { binding = NAME, … }` configures a
# CLI option with named fields
# • Option fields — binding, 簡, 詳, 型別, 描述, and 全局
# control how the option is parsed and documented
#
# Common mistakes:
# • omitting required fields like `binding` or `詳` in `@ 選項` braced records; boolean flags need `型別 布林`
#
# See also: 選項, cli, annotation-sugar
# =============================================================================
# Braced @ 選項 — canonical option record
#
# TARGET: annotation-sugar stage 2
# PAIR: sugar `@ 選項 NAME 簡 \"x\" ...` (see 選項/optio.fab)
@ 命令行 { name = "optio-braced-smoke" }
@ option { binding = verbose, short = "v", long = "verbose", type = bool, description = "Verbose mode", global = true }
main args args {
}radix/corpus/optio/optio.fab (canonical · keyword)#
Declares a CLI option annotation.
# =============================================================================
# 選項 — Declares a CLI option annotation.
# =============================================================================
#
# What this teaches:
# • CLI options — `@選項` 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 選項 without at least one of 簡 or 詳 — boolean flags need a flag form to be usable.
#
# See also: 操作數, cli, 命令, 全局, vel
# =============================================================================
# 選項 — CLI option annotation
#
# GRAMMAR:
# annotation :← '@' '選項' optionSpec
#
# EXPECTED OUTPUT:
# No 入口 — declaration or test-runner surface only.
#
# BACKEND:
# declaration-only CLI metadata (whitelist: 選項/optio.fab).
#
@ 命令行 "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 {
}