cli

package
v0.3.0 Latest Latest
Warning

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

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

Documentation

Overview

Package cli is the modelspec command line: lint, export, rewrite, version and self-update. Everything the commands touch (filesystem, output streams, build information, the update source) comes in through Env, so tests run them in memory.

Index

Constants

View Source
const (
	ExitOK              = 0
	ExitFindings        = 1
	ExitUsage           = 2
	ExitUpdateAvailable = 10
)

Exit codes. Lint and export use 0, 1 and 2; 10 is reserved for `self-update --check` finding a newer release.

Variables

This section is empty.

Functions

func Run

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

Run executes the command line (without the program name) and returns the process exit code.

Types

type Env

type Env struct {
	Stdout, Stderr io.Writer
	FS             modelspec.FS
	Build          buildinfo.Info
	Update         selfupdate.Config
	// Interactive reports whether stdin is a terminal; nil means the
	// self-update library's own check.
	Interactive func() bool
	// MaxTwinBytes is the largest JSON twin export writes; zero means
	// modelspec.MaxInputBytes, the largest file lint reads. A seam for tests.
	MaxTwinBytes int
}

Env is everything a command touches outside its own arguments.

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