cli

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Overview

Package cli implements the foreman admin CLI: migrate, jobs, queues, leader, periodic, stats, config and version commands. Commands run in process so tests can compare their output with golden files.

code := cli.Run(ctx, os.Args[1:], cli.IO{Stdout: os.Stdout, Stderr: os.Stderr, Getenv: os.Getenv}, build)

Index

Constants

View Source
const (
	ExitOK     = 0
	ExitError  = 1
	ExitConfig = 2
)

Exit codes.

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, args []string, io IO, build BuildInfo) int

Run executes the CLI with args and returns the exit code.

Types

type BuildInfo

type BuildInfo struct {
	Version, Commit, BuildDate string
}

BuildInfo is set by the linker in cmd/foreman.

type IO

type IO struct {
	Stdout, Stderr io.Writer
	Getenv         func(string) string
}

IO holds the process environment, so tests can run commands in process.

Jump to

Keyboard shortcuts

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