Documentation
¶
Overview ¶
Package cli implements Locorum's command-line surface. The same binary that runs the GUI parses os.Args before app.Main() and dispatches a CLI subcommand here when one is recognised. Every mutating command in this package shells JSON-RPC over the IPC socket to the daemon — this package never talks to Docker / SQLite directly.
Output rules:
- Tables go to stdout, errors to stderr.
- Exit codes are documented per command (0 = success, 1 = error, 2 = invalid usage, 3 = no daemon).
- --json prints JSON-encoded results, suitable for scripting.
- NO_COLOR and a non-TTY stdout both suppress ANSI sequences.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsCLIInvocation ¶
IsCLIInvocation is the public hook main.go uses. Same as isCLIVerb but exported so the package boundary is explicit.
func IsDaemonVerb ¶
IsDaemonVerb reports whether os.Args asks for an explicit daemon boot. Distinct from auto-spawn: the user can run `locorum daemon` to get a headless process for CI.
Types ¶
type Command ¶
type Command interface {
Name() string
Synopsis() string
Run(ctx context.Context, env *Env) ExitCode
}
Command is the runtime contract every subcommand satisfies.
type Env ¶
type Env struct {
Stdout io.Writer
Stderr io.Writer
Args []string // arguments AFTER the subcommand keyword
HomeDir string
ExePath string // absolute path to the locorum binary, for auto-spawn
Version string
}
Env carries every dependency a CLI command needs. Constructed once per invocation by main.go; injected into every subcommand so tests can capture stdout/stderr without process-global state.
type ExitCode ¶
type ExitCode int
ExitCode classifies the outcome of a CLI invocation. Numeric values are part of the public contract — scripts depend on them.