cli
Translation status: English reader-locale proof. Term names and code fences follow the en pack; supporting prose may still be English.
CLI root with options, operands, subcommands, and module mounts.
Syntax: @ cli <name>
Category#
cli
Related#
Examples#
radix/corpus/reference/annotation/cli/cli-braced.fab (canonical · annotation)#
Braced canonical @ cli program marker.
# =============================================================================
# cli — Braced canonical @ cli program marker.
# =============================================================================
#
# What this teaches:
# • Braced annotation syntax — `@ cli { name = "NAME" }` sets the CLI
# program name using brace-delimited key-value pairs
# • Multi-annotation CLI setup — combining `@ cli` with `@ option` 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, option, annotation-sugar
# =============================================================================
# Braced @ cli — canonical program name record
#
# TARGET: annotation-sugar stage 2
# PAIR: sugar `@ cli "NAME"` (see option/optio.fab)
@ cli { name = "annotation-sugar-smoke" }
@ option { binding = verbose, short = "v", long = "verbose", type = bool, description = "Verbose mode" }
main args args {
}radix/corpus/reference/annotation/cli/cli.fab (canonical · annotation)#
CLI root with options, operands, subcommands, and module mounts.
@ command { name = "greet" }
@ alias "g"
@ description "Greet by name"
@ operand { type = string, binding = name, description = "Name to greet" }
fn greet() args args → void {
if args.verbose {
print "verbose"
}
print "Salve, §!"(args.nomen)
}
@ command { name = "version" }
@ alias "v"
fn version() → void {
print "exemplum v0.1.0"
}
# =============================================================================
# cli — CLI root with options, operands, subcommands, and module mounts.
# =============================================================================
#
# What this teaches:
# • Full CLI framework — `@ cli`, `@ version`, `@ description`, `@ option`,
# `@ operand`, `@ command`, and `@ alias` compose a complete CLI
# application definition
# • Subcommands — `@ command "greet"` declares a subcommand with its own
# options and operands
# • Module mounting — `@ commands` imports command modules from packages
#
# Common mistakes:
# • attaching `@ cli` to a `fn` instead of an `main` (SEM009), or reusing duplicate CLI flags or binding names within the same CLI surface
#
# See also: command, commands, option, operand, args, description,
# global, version, alias
# =============================================================================
# cli — structured CLI annotation tour
#
# @ cli / @ version / @ description / @ option / @ operand / @ command / @ alias
# @ commands mounts imported command modules (see package-cli fixture).
#
# GRAMMAR:
# cliDecl :← '@' 'cli' stringLit
# main args args { ... }
#
# EXPECTED OUTPUT:
# Requires CLI flags/args at run time; no fixed stdout contract.
#
# BACKEND:
# Rust runtime whitelist (missing operand 'name'); Go compile whitelist.
# Cross-ref option/, operand/, description/, global/, args/ keyword dirs.
@ cli { name = "exemplum" }
@ version "0.1.0"
@ description "Faber CLI framework smoke exemplum"
@ option { binding = verbose, short = "v", long = "verbose", type = bool, description = "Enable verbose output", global = true }
main args args {
}