cli

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2026 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Overview

Package cli dispatches soapbox subcommands.

Dispatch uses the standard library flag package. Every command writes to injected writers and returns an error, so the process exit code is decided in exactly one place and no code path calls os.Exit or panics on bad input.

Index

Constants

View Source
const (
	// ExitOK reports success.
	ExitOK = 0
	// ExitFailure reports an unexpected runtime failure.
	ExitFailure = 1
	// ExitUsage reports a malformed command line.
	ExitUsage = 2
	// ExitCheck reports that the command ran and found policy violations.
	ExitCheck = 3
	// ExitCanceled reports that the context ended before the command did.
	ExitCanceled = 4
)

Process exit codes. They are part of the workflow contract, so they are stable and distinct.

View Source
const Version = buildinfo.Version

Version is the engine version reported by the version command.

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, env Env, args []string) int

Run dispatches one command line and returns the process exit code.

Types

type Env

type Env struct {
	// Stdout receives command output. A nil writer discards it.
	Stdout io.Writer
	// Stderr receives diagnostics. A nil writer discards it.
	Stderr io.Writer
	// Dir is the working directory relative paths resolve against.
	Dir string
}

Env carries the injectable process environment of one command run.

Jump to

Keyboard shortcuts

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