Help us shape the future of Go! Take the 2026 Go Developer Survey

cli

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package cli is the leaf of steerloop: command dispatch, the environment contract and exit codes. It imports nothing from steerloop, so every other package can import it without a cycle.

Index

Constants

View Source
const (
	ExitOK            = 0
	ExitError         = 1
	ExitUsage         = 2
	ExitMaxIterations = 3
	ExitTimeout       = 4
	ExitAwaitingHuman = 5
	ExitStopped       = 130
)

Exit codes.

View Source
const Usage = `` /* 612-byte string literal not displayed */

Usage is the top-level help: every command, one line each.

Variables

This section is empty.

Functions

func ExitCodeFor

func ExitCodeFor(reason event.DoneReason) int

ExitCodeFor maps how a run ended to the process exit code.

Types

type App

type App struct {
	// contains filtered or unexported fields
}

App dispatches `steerloop <command>` to the Command registered for it. main supplies the commands, so this package never imports them.

func NewApp

func NewApp(env Environment, commands map[string]Command) *App

func (*App) Run

func (a *App) Run(ctx context.Context, args []string) int

type Command

type Command interface {
	Run(ctx context.Context, args []string) int
}

Command is one `steerloop <name>` subcommand. → internal/cmds/run

type Environment

type Environment interface {
	Getenv(key string) string
	Stdin() io.Reader
	Stdout() io.Writer
	Stderr() io.Writer
	StdinIsTerminal() bool
}

Environment is everything the CLI takes from the OS. → internal/osenv App is its top-level user; commands receive it from main.

Jump to

Keyboard shortcuts

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