การเรนเดอร์th-TH

cli

Translation status: ภาษาไทย reader-locale proof. Term names and code fences follow the th-TH pack; supporting prose may still be English.

CLI root with options, operands, subcommands, and module mounts.

Syntax: @ cli <name>

Category#

cli

Examples#

radix/corpus/annotation-sugar/cli-braced.fab (canonical · annotation)#

Braced canonical @ cli program marker.

# =============================================================================
# cli — Braced canonical @ cli program marker.
# =============================================================================
#
# What this teaches:
#   • Braced annotation syntax — `@ cli { ชื่อ = "NAME" }` sets the CLI
#     program name using brace-delimited key-value pairs
#   • Multi-annotation CLI setup — combining `@ cli` with `@ ตัวเลือก` to
#     configure a command-line program and its options
#
# Common mistakes:
#   • mixing braced and sugar annotation syntax on the same declaration; pick one canonical form per annotation
#
# See also: cli, ตัวเลือก, annotation-sugar
# =============================================================================

# Braced @ cli — canonical program name record
#
# TARGET: annotation-sugar stage 2
# PAIR: sugar `@ cli "NAME"` (see ตัวเลือก/optio.fab)

@ cli { name = "annotation-sugar-smoke" }
@ option { binding = verbose, short = "v", long = "verbose", type = bool, description = "Verbose mode" }
main args args {
}

radix/corpus/cli/cli.fab (canonical · annotation)#

CLI root with options, operands, subcommands, and module mounts.

# =============================================================================
# cli — CLI root with options, operands, subcommands, and module mounts.
# =============================================================================
#
# What this teaches:
#   • Full CLI framework — `@ cli`, `@ versio`, `@ คำอธิบาย`, `@ ตัวเลือก`,
#     `@ ตัวถูกดำเนินการ`, `@ คำสั่ง`, and `@ alias` compose a complete CLI
#     application definition
#   • Subcommands — `@ คำสั่ง "greet"` declares a subcommand with its own
#     options and operands
#   • Module mounting — `@ imperia` imports command modules from packages
#
# Common mistakes:
#   • attaching `@ cli` to a `ฟังก์ชัน` instead of an `เริ่ม` (SEM009), or reusing duplicate CLI flags or binding names within the same CLI surface
#
# See also: คำสั่ง, imperia, ตัวเลือก, ตัวถูกดำเนินการ, อาร์กิวเมนต์, คำอธิบาย,
#   โกลบอล, versio, alias
# =============================================================================

# cli — structured CLI annotation tour
#
# @ cli / @ versio / @ คำอธิบาย / @ ตัวเลือก / @ ตัวถูกดำเนินการ / @ คำสั่ง / @ alias
# @ imperia mounts imported command modules (see package-cli fixture).
#
# GRAMMAR:
#   cliDecl :← '@' 'cli' stringLit
#   เริ่ม อาร์กิวเมนต์ args { ... }
#
# EXPECTED OUTPUT:
#   Requires CLI flags/args at run time; no fixed stdout contract.
#
# BACKEND:
#   Rust runtime whitelist (missing operand 'ชื่อ'); Go compile whitelist.
#   Cross-ref ตัวเลือก/, ตัวถูกดำเนินการ/, คำอธิบาย/, โกลบอล/, อาร์กิวเมนต์/ keyword dirs.

@ cli "exemplum"
@ versio "0.1.0"
@ description "Faber CLI framework smoke exemplum"
@ option verbose short "v" long "verbose" type bool global description "Enable verbose output"
main args args {
}

@ command "greet"
@ alias "g"
@ description "Greet by name"
@ operand string ชื่อ description "Name to greet"
fn greet() args args → void {
    if args.verbose {
        print "verbose"
    }
    print "Salve, §!"(args.nomen)
}

@ command "version"
@ alias "v"
fn version() → void {
    print "exemplum v0.1.0"
}