Documentation
¶
Overview ¶
Package cli is the command line of mtqg: it reads the arguments, calls the core, and shows the result.
It is the only place where mtqg speaks: every sentence it prints is English and lives in messages.go, and the core below it returns kinds of error and structured results instead (.claude/rules/cli-output.md). Run takes everything it touches in an Env (the streams, the environment variables, the clock, the terminal), so that tests call it directly.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Env ¶
type Env struct {
Stdin io.Reader
Stdout io.Writer
Stderr io.Writer
// Getenv returns an environment variable, empty when it is not set.
Getenv func(string) string
// Getwd returns the current directory.
Getwd func() (string, error)
// Now returns the current time. Location is where times are shown.
Now func() time.Time
Location *time.Location
// StdoutIsTerminal says that standard output is a terminal, not a pipe or a
// file. Only then is text cut to the width of the window and color used.
StdoutIsTerminal bool
// StdoutWidth is the width of the terminal window in columns, or 0 when it is
// not known.
StdoutWidth int
// ANSI says that the terminal understands color codes.
ANSI bool
// TTY names the terminal that the command was typed at, for undo to tell one
// terminal from another: "dev:" and the device number of the first of standard
// input, output and error that is a terminal. Empty when there is none, and
// always on Windows. It is never written as it is: terminalID hashes it.
TTY string
// ReadFile reads a file. It is what format is given as an argument.
ReadFile func(name string) ([]byte, error)
// RunEditor runs an editor, given as the command and its arguments, with the
// terminal attached, and returns when the editor has exited.
RunEditor func(argv []string) error
// Version is the version the release build set (cmd/mtqg's main.version, the
// tag as v0.1.0), or empty: then it comes from the build information.
Version string
}
Env is everything Run touches outside the arguments. cmd/mtqg fills it from the operating system (OSEnv); tests fill it with buffers and fixed values.
Source Files
¶
- add.go
- agent_claude.go
- ansi_other.go
- archive.go
- args.go
- author.go
- candidates.go
- completion.go
- context.go
- doc.go
- done.go
- edit.go
- env.go
- env_os.go
- format.go
- glossary.go
- help.go
- hook.go
- hook_claude.go
- init.go
- json.go
- list.go
- log.go
- mcp.go
- mcp_tools.go
- messages.go
- render.go
- report.go
- review.go
- run.go
- search.go
- show.go
- status.go
- text.go
- thread.go
- tty_unix.go
- undo.go
- upgrade.go
- version.go
- width.go