cli

package
v0.0.0-...-6adb3ad Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2026 License: Apache-2.0 Imports: 34 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

func Execute(ctx context.Context, args []string, stdout, stderr io.Writer, build Build) int

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL