cli

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 37 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 the sitrep command line: it parses arguments, runs the commands and prints their answers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(args []string, e Env) int

Run runs one command line (without the program name) and returns the exit status.

Types

type Env

type Env struct {
	Home       string
	Getenv     func(string) string
	Stdin      io.Reader
	Stdout     io.Writer
	Stderr     io.Writer
	Clock      clock.Clock
	Runner     runner.Runner
	TTY        func() (io.ReadCloser, error)    // the controlling terminal, for questions; nil or an error means there is none
	Executable func() (string, error)           // the path of this program
	Spawn      func(args ...string) error       // starts this program again, detached; the hook uses it for the summarizer
	Alive      func(pid int) bool               // whether a process exists; nil means ask the system
	TermSize   func() (rows, cols int, ok bool) // the size of the terminal on standard output; nil or !ok means there is none
	Hostname   func() (string, error)           // the name of this machine, for the history log; nil means "host"
	// contains filtered or unexported fields
}

Env is everything a command touches outside its arguments, so tests can replace it.

func OSEnv

func OSEnv() Env

OSEnv is the real process environment.

Jump to

Keyboard shortcuts

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