Documentation
¶
Overview ¶
Package cli wires the cobra command tree. Discoverability features:
- auto --help on every (sub)command, with examples
- did-you-mean suggestions for mistyped commands (cobra built-in)
- global --output table|json with a stable error envelope
- stable, documented exit codes (see `normatik explain exit-codes`)
Shared machinery (deps, handled errors, error-render, resource registry) lives in internal/command; this package only wires commands together.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LeafCommandPaths ¶
func LeafCommandPaths() []string
LeafCommandPaths builds the real cobra command tree (the same tree Main() executes against — including cobra's built-in `help`/`completion`, added the same way Execute() adds them) and returns the full space-joined path of every LEAF command (a command with no children — the only nodes that ever make an API call or run their own logic; pure routing parents like `pages` or `users` are excluded). Hidden commands (cobra's own `__complete`/`__completeNoDesc` shell-completion protocol commands) are excluded too: they are not discoverable, agent-facing commands.
This exists so the e2e completeness guard (e2e's INFRA test) can diff the CLI's actual command surface against the READ_ONLY read/write matrices without parsing --help text (styled/rendered by fang, not a stable format) and without re-deriving the tree via source/AST scanning (most `Use:` strings are passed through builder helpers as parameters, not literals in a `cobra.Command{}` composite literal, so an AST walk over composite literals alone would silently miss most leaves).
func Main ¶
func Main() int
Main builds and runs the root command and returns the process exit code. fang adds styled help, --version, completion and styled errors; we keep our own structured API-error rendering + exit-code mapping by passing a custom error handler that skips errors we already rendered ourselves.
Types ¶
type LeafCommand ¶
LeafCommand is one visible leaf of the real command tree with its read/mutating classification (from the write annotation, inherited down the subtree it was registered under).
func LeafCommands ¶
func LeafCommands() []LeafCommand
LeafCommands returns every visible leaf with its classification, sorted by path. Same tree semantics as documented above for LeafCommandPaths.
Source Files
¶
- atomic_replace_unix.go
- atomic_write.go
- auth.go
- banner.go
- commandtree.go
- completion.go
- confirm.go
- login_browser.go
- macros.go
- macros_docs.go
- menu.go
- meta.go
- page_types_find.go
- pages.go
- property_flags.go
- readhelpers.go
- release_notes.go
- resources.go
- root.go
- style.go
- theme.go
- urlflag_help.go
- writehelpers.go
- writes_cmd.go
- writes_cmd2.go
- writes_pages.go