ui

package
v0.66.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
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 Exit

func Exit(code int, format string, args ...any) cli.ExitCoder

Exit ends the command with code and a message carrying the f10 prefix.

func Interactive

func Interactive() bool

Interactive reports whether a person can both read and answer: stdin and stdout are terminals.

func IsTerminal

func IsTerminal(w io.Writer) bool

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 JSON

func JSON(w io.Writer, v any) error

JSON writes v the way every --json prints: indented two spaces, one trailing newline.

func JSONFlag

func JSONFlag(usage string) cli.Flag

JSONFlag is the --json flag; usage says what the command emits.

func Open

func Open(ctx context.Context, dir, target string) error

Open hands target, a url or a path, to the OS's opener.

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 Prefixed

func Prefixed(msg string) string

Prefixed is msg as every f10 message opens: "f10: <msg>".

func StdinTerminal

func StdinTerminal() bool

StdinTerminal reports whether stdin is a terminal rather than piped input.

func Warnf

func Warnf(w io.Writer, format string, args ...any)

Warnf writes one warning line carrying the f10 prefix.

func Width

func Width(w io.Writer) int

Width is w's terminal width, 0 when piped, so output stays unwrapped for grep.

Types

type Terminal

type Terminal interface {
	Terminal() bool
}

A Terminal writer says for itself whether it stands for a terminal, as a buffer copied on to one does.

Jump to

Keyboard shortcuts

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