Documentation
¶
Overview ¶
Package ui is how a command talks to whoever runs it: a person at a terminal, a pipe, or an agent parsing --json. It holds no project state, so every command can depend on it.
Index ¶
- Constants
- func Exit(code int, format string, args ...any) cli.ExitCoder
- func Interactive() bool
- func IsTerminal(w io.Writer) bool
- func JSON(w io.Writer, v any) error
- func JSONFlag(usage string) cli.Flag
- func Open(ctx context.Context, dir, target string) error
- func PlainWidth() int
- func Prefixed(msg string) string
- func StdinTerminal() bool
- func Warnf(w io.Writer, format string, args ...any)
- func Width(w io.Writer) int
- type Terminal
Constants ¶
const ( // ExitUsage is a flag or argument the command cannot read. ExitUsage = 2 // ExitDeclined is a normal "not here" answer the caller acts on, the same // code a driver declines with (driver.ExitUnsupported): task children with // no parent link, task create with no driver, task comment and update with // no write, forward with the task in this checkout, finish of someone // else's PR, start with no task named, and review round with no next round. ExitDeclined = 3 // ExitAsk is a drive stopped on an ask the skill relays. ExitAsk = 4 // ExitHalted is a drive stopped by any other halt. ExitHalted = 5 // ExitRiders is finish of a bundle whose riders have no --close answer // yet: the finish skill asks which the PR delivers and reruns. ExitRiders = 7 // ExitPending is pr checks on a head whose checks are still running, the // code gh pr checks uses; red is 1. ExitPending = 8 )
The exit codes skills, f10 start and docs/cli.md read. A code's meaning is per command, so 6 and 7 also mean "drained" and "nothing watched" for drive and watch (internal/daemon owns those, as its protocol writes them).
Variables ¶
This section is empty.
Functions ¶
func Interactive ¶
func Interactive() bool
Interactive reports whether a person can both read and answer: stdin and stdout are terminals.
func IsTerminal ¶
IsTerminal reports whether w is a terminal, so escape codes and paging go only to a person and never into what an agent or script parses.
func PlainWidth ¶
func PlainWidth() int
PlainWidth is the width plain output is cut to: $COLUMNS, else 100, as a skill relays it into a pane whose width the binary cannot read.
func StdinTerminal ¶
func StdinTerminal() bool
StdinTerminal reports whether stdin is a terminal rather than piped input.