Documentation
¶
Overview ¶
Package cli builds the command-line interface from the registry: every Spec becomes a cobra subcommand with its flags.
Index ¶
Constants ¶
const ( ExitOK = 0 ExitInput = 1 // invalid input ExitUsage = 2 // usage error ExitInternal = 3 // internal error )
Exit codes.
const DefaultMaxInput = 64 << 20
DefaultMaxInput is the --max-input limit (64 MB).
Variables ¶
This section is empty.
Functions ¶
func ConfigFlag ¶ added in v1.1.0
ConfigFlag finds the value of --config in args before cobra parses them: main needs it to know whether to look for plugins.
Types ¶
type Deps ¶
type Deps struct {
Registry *registry.Registry
Stdin io.Reader
Stdout, Stderr io.Writer
StdinTTY bool
StdoutTTY bool
Getenv func(string) string
RenderStyles render.Styles
// LightRenderStyles colour the output when the config says
// theme = "light"; zero falls back to RenderStyles. The CLI never asks
// the terminal for its background, so "auto" means dark.
LightRenderStyles render.Styles
// TermWidth gives the terminal width for wrapped outputs (Markdown);
// nil means 80 columns.
TermWidth func() int
RunTUI func(TUIRequest) error // nil: no TUI available
Clipboard clipboard.Clipboard // for --copy
// Plugins found at startup, for "devtooltui plugin list";
// PluginsOff when the config turned them off.
Plugins []plugin.Info
PluginsOff bool
// UserConfigDir locates the default config.toml; nil means no default
// file (tests), only --config or $DEVTOOLTUI_CONFIG.
UserConfigDir func() (string, error)
Version, Commit string
}
Deps is everything the CLI takes from the environment; tests replace it.