渲染zh-Hans

选项

Translation status: 简体中文 reader-locale proof. Term names and code fences follow the zh-Hans 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

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 {
}