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/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 = "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/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`, `@ 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 — `@ imperia` 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, imperia, option, operand, args, description,
# global, versio, alias
# =============================================================================
# cli — structured CLI annotation tour
#
# @ cli / @ versio / @ description / @ option / @ operand / @ command / @ alias
# @ imperia 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 "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 name 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"
}