Documentation
¶
Overview ¶
Package cli is the CLI frontend: it consumes a registry's entries and turns their cli bindings (shorthands, positionals, env fallbacks, transport-specific defaults) into a command tree. Dotted registry names map to nested subcommands: "user.add" becomes "user add".
The frontend is implemented on the standard library only (no cobra / pflag), so this package carries zero third-party dependencies.
Output rendering lives in Render: primitives print bare (no {"data": ...} envelope), structs print as aligned key/value pairs, slices of structs as an aligned table, and --json flips everything to raw JSON.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Version = "dev"
Version is the version reported by the CLI frontend's -v/--version flag when the frontend is embedded directly via cli.Run. The root dispatcher (xyz.Run) owns its own xyz.Version and answers -v before reaching here.
Functions ¶
func Render ¶
Render writes the CLI frontend's default human-readable form of a command result:
nil -> nothing string -> the raw string bool, int, float -> the bare value time.Time -> RFC 3339 []basic -> one element per line struct, *struct -> aligned "key value" pairs from json-tagged fields []struct -> an aligned table (header + separator + rows) map -> sorted "key value" pairs
The result is never wrapped in an envelope like {"data": ...}: --json emits the raw JSON value instead of calling Render.