ui

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Current   = "●"
	Pending   = "◐"
	Pass      = "✓"
	Fail      = "✗"
	ArrowDown = "⇣"
	ArrowUp   = "⇡"
	PushUp    = "⬆"
	Dash      = "—"
	NoReview  = "○"
	ErrorMark = "✗"
)

Glyphs used throughout the UI.

Variables

View Source
var (
	Green   = color.New(color.FgGreen).SprintFunc()
	Yellow  = color.New(color.FgYellow).SprintFunc()
	Red     = color.New(color.FgRed).SprintFunc()
	Blue    = color.New(color.FgBlue).SprintFunc()
	Cyan    = color.New(color.FgCyan).SprintFunc()
	Magenta = color.New(color.FgMagenta).SprintFunc()
	Dim     = color.New(color.FgHiBlack).SprintFunc()
	Bold    = color.New(color.Bold).SprintFunc()

	GreenF  = color.New(color.FgGreen).PrintfFunc()
	YellowF = color.New(color.FgYellow).PrintfFunc()
	BlueF   = color.New(color.FgBlue).PrintfFunc()
	CyanF   = color.New(color.FgCyan).PrintfFunc()
	DimF    = color.New(color.FgHiBlack).PrintfFunc()
)

Color shortcuts — matches the fish script's set_color calls.

Functions

func ClearLines added in v1.3.0

func ClearLines(n int)

ClearLines moves the cursor up n lines and clears each one. Used by wt watch to redraw the live status table in-place. No-op when stdout is not a terminal.

func Confirm

func Confirm(message string, defaultYes bool) bool

Confirm prompts the user with a y/n question. defaultYes: if true, pressing Enter means yes (Y/n); if false, means no (y/N).

func Error

func Error(format string, args ...any)

Error prints an error message with ✗ prefix.

func Header(text string)

Header prints a dim section header (like "WORKTREES").

func Info

func Info(format string, args ...any)

Info prints a regular message.

func IsTTY added in v1.6.0

func IsTTY() bool

IsTTY reports whether stdout is connected to a terminal.

func PrintCTA added in v1.12.0

func PrintCTA(cmds ...string)

PrintCTA prints machine-readable call-to-action suggestions for agent consumers. Only emits output when stdout is not a TTY — human terminal output is unaffected. Format: "cta: cmd1 | cmd2"

func PrintCdHint

func PrintCdHint(path string)

PrintCdHint tells the shell wrapper to cd into the given path. When WT_CD_FILE is set (by the shell wrapper), writes the path to that file. Otherwise prints a hint so the user knows to cd manually.

func Success

func Success(format string, args ...any)

Success prints a success message with ✓ prefix.

func Truncate

func Truncate(s string, max int) string

Truncate shortens a string to max runes, adding "…" if truncated.

func Warn

func Warn(format string, args ...any)

Warn prints a warning message.

Types

type Spinner

type Spinner struct {
	// contains filtered or unexported fields
}

Spinner shows an animated wave indicator for long-running operations. The animation uses block element characters rendered as a 3-bar equalizer.

func NewSpinner

func NewSpinner(message string) *Spinner

NewSpinner starts an animated spinner with the given message (auto-dimmed). Call Stop() to clear the spinner line and release resources.

func NewSpinnerRich

func NewSpinnerRich(message string) *Spinner

NewSpinnerRich starts a spinner that renders the message as-is, without wrapping it in Dim. Use this when the message contains its own ANSI colors.

func (*Spinner) Stop

func (s *Spinner) Stop()

Stop clears the spinner line and joins the goroutine. Safe to call multiple times.

Jump to

Keyboard shortcuts

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