cli

package
v0.3.0 Latest Latest
Warning

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

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

Documentation

Overview

Package cli is the meaninggraph command line: the commands, their output and their exit codes. Everything that touches the outside world (the file system, the output streams, the terminal, the update server) comes in through Env, so the whole command line runs in a test without a process, a network or a real terminal.

Index

Constants

View Source
const (
	// ExitClean means the command succeeded: a check found no error.
	ExitClean = 0
	// ExitFindings means a check found at least one finding of error severity.
	ExitFindings = 1
	// ExitUsage means the command was used wrongly or a file could not be
	// read: nothing was checked.
	ExitUsage = 2
)

Exit codes of the command line.

Variables

This section is empty.

Functions

func Run

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

Run runs the command line with the arguments after the program name and returns the exit code. It never exits the process itself.

Types

type Env

type Env struct {
	Stdin          io.Reader
	Stdout, Stderr io.Writer
	// FS reads the files that are checked.
	FS meaning.FS
	// Abs makes a path absolute, so that one directory written two ways is
	// read once.
	Abs func(string) (string, error)
	// Interactive says whether the process has a terminal to ask a question
	// on; nil means the update library's own terminal check.
	Interactive func() bool
	// SelfUpdate describes where updates come from; tests point it at a fake
	// release server.
	SelfUpdate func() selfupdate.Config
}

Env is everything the command line needs from the outside.

func OSEnv

func OSEnv() Env

OSEnv is the environment of the real process.

Jump to

Keyboard shortcuts

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