ตัวเลือก
Translation status: ภาษาไทย reader-locale proof. Term names and code fences follow the th-TH 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)
@ cli { 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).
#
@ 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 {
}