Documentation
¶
Overview ¶
Package cli is the command tree: Cobra commands, global flags, and how an error becomes an exit code (design §3, §6).
Commands write to cmd.OutOrStdout() and cmd.ErrOrStderr(), never to os.Stdout and os.Stderr directly. Run sets those writers, so the binary gets the real streams and a test gets a buffer, with no other difference.
Index ¶
Constants ¶
const ( ExitOK = 0 // done, possibly from cache ExitFailed = 1 // anything not covered below ExitUsage = 2 // wrong usage: unknown command or flag, bad value ExitUnreachable = 3 // Quantic unreachable, and nothing cached ExitNotSignedIn = 4 // no token, or Quantic rejected it (401) ExitRateLimited = 5 // still rate limited after retrying )
Exit codes (design §6). A script or the widget branches on these, so they are part of the CLI's contract: a meaning never changes once released.
Variables ¶
This section is empty.
Functions ¶
func ExitCode ¶
ExitCode is the exit status an error from a command maps to: 0 for nil, the code of the first ExitError in its chain, otherwise ExitFailed.
Types ¶
type Build ¶
type Build struct {
Version string
Commit string
Date string // the commit's date, not the build's: see main.go
}
Build is the stamp main receives from the linker. Any field can be empty: a `go build` or `go install` sets none of them.