ui

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package ui provides terminal UI components for wt command output.

This package uses the Charm libraries (lipgloss, bubbles) for styled terminal output including tables and spinners.

Table Formatting

The primary components are table formatters for list and prune output:

  • FormatListTable: Renders worktree list with ID, repo, branch, status, last commit, notes, and PR info columns
  • FormatPruneTable: Simplified table for prune preview showing which worktrees will be removed and why

Tables use lipgloss styling with:

  • Normal borders in gray (color 240)
  • Bold headers
  • Cell padding for readability

PR Status Display

The list table shows PR status with visual indicators:

  • "-" : No upstream branch (can't have PR)
  • "?" : Not fetched yet
  • State + author + comments + reviews + URL for existing PRs
  • "✓" for approved, "◐" for pending reviews

Spinner (Experimental)

The Spinner type wraps Bubbletea for simple non-interactive progress indication. Currently unused but available for long-running operations.

Design Notes

Output is designed for terminal display with:

  • Monospace font assumptions
  • ANSI color support
  • Truncation for long values (e.g., notes limited to 30 chars)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatListTable added in v0.5.0

func FormatListTable(worktrees []git.Worktree, pathToID map[string]int, wtCache *cache.Cache) string

FormatListTable creates a formatted table for list command output

func FormatPruneTable added in v0.5.0

func FormatPruneTable(worktrees []git.Worktree, pathToID map[string]int, reasonMap map[string]string, pruneMap map[string]bool) string

FormatPruneTable creates a simplified table for prune output with reason column

func FormatSummary

func FormatSummary(removed, skipped int, dryRun bool) string

FormatSummary formats the summary line

Types

type Spinner

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

Spinner wraps a Bubbletea spinner for simple non-interactive use

func NewSpinner

func NewSpinner(message string) *Spinner

NewSpinner creates a new spinner with the given message

func (*Spinner) Start

func (s *Spinner) Start()

Start begins the spinner animation

func (*Spinner) Stop

func (s *Spinner) Stop()

Stop stops the spinner and clears the line

func (*Spinner) UpdateMessage

func (s *Spinner) UpdateMessage(message string)

UpdateMessage changes the spinner message

Jump to

Keyboard shortcuts

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