Documentation
¶
Overview ¶
Package cli is stillhere's command line: the cobra commands and flags, the exit codes, and the composition root, the one place where adapters are built and handed to the use cases in internal/app (Mark Seemann, "Composition Root"). Commands parse and validate input at this boundary and pass typed requests inward, so a use case never sees a flag.
Each command lives in its own file. Shared plumbing lives here: the global flags, building dependencies on demand, rendering, and mapping errors to exit codes.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Execute ¶
Execute runs the command line with args, which exclude the program name, and returns the exit code (docs/spec/report-json.md#exit-codes): 0 on success; 1 when the command failed or no repository produced facts; 2 for a usage error; 130 when a command failed after ctx was cancelled, which is how cmd/stillhere reports a signal. It prints at most one error line to stderr and never calls os.Exit (cmd/stillhere turns off cobra's Windows mousetrap, which would).
Types ¶
type Build ¶
type Build struct {
Version string // release version, such as "0.1.0"; a leading "v" is dropped
Commit string // git SHA the binary was built from: full from -ldflags or vcs.revision, the first 12 digits from a pseudo-version
Date string // build time, RFC 3339; only an -ldflags build knows it
// Committed is the commit's time, RFC 3339 in UTC, from the build
// information (vcs.time) or a pseudo-version (RB-13); "" when unknown.
// It is not the build's time, which Date is.
Committed string
}
Build identifies the binary. cmd/stillhere fills it from variables that the release build injects with -ldflags -X.