ui

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Primary   = lipgloss.Color("#4CAF50")
	Secondary = lipgloss.Color("#A1887F")

	ColorSuccess = lipgloss.Color("#66BB6A")
	ColorWarning = lipgloss.Color("#FFA726")
	ColorError   = lipgloss.Color("#EF5350")
	ColorInfo    = lipgloss.Color("#29B6F6")
	ColorMuted   = lipgloss.AdaptiveColor{Dark: "#9E9E9E", Light: "#555555"}

	Text    = lipgloss.AdaptiveColor{Dark: "#F9FAFB", Light: "#111111"}
	TextDim = lipgloss.AdaptiveColor{Dark: "#9CA3AF", Light: "#6B7280"}
)
View Source
var (
	HeaderStyle = lipgloss.NewStyle().
				Bold(true).
				Foreground(Primary).
				MarginBottom(1)

	SuccessBadge = lipgloss.NewStyle().
					Foreground(lipgloss.Color("#000")).
					Background(ColorSuccess).
					Padding(0, 1).
					Bold(true)

	WarningBadge = lipgloss.NewStyle().
					Foreground(lipgloss.Color("#000")).
					Background(ColorWarning).
					Padding(0, 1).
					Bold(true)

	ErrorBadge = lipgloss.NewStyle().
				Foreground(lipgloss.Color("#FFF")).
				Background(ColorError).
				Padding(0, 1).
				Bold(true)

	BoxStyle = lipgloss.NewStyle().
				Border(lipgloss.RoundedBorder()).
				BorderForeground(Primary).
				Padding(1, 2)

	MutedStyle = lipgloss.NewStyle().
				Foreground(ColorMuted)

	CodeStyle = lipgloss.NewStyle().
				Foreground(ColorInfo).
				Bold(true)

	InfoBadge = lipgloss.NewStyle().
				Foreground(lipgloss.Color("#000")).
				Background(ColorInfo).
				Padding(0, 1).
				Bold(true)

	MainWorktreeStyle = lipgloss.NewStyle().
						Foreground(Secondary).
						Bold(true)

	CurrentWorktreeStyle = lipgloss.NewStyle().
							Foreground(ColorSuccess).
							Bold(true)
)
View Source
var ErrUserAborted = errors.New("user aborted")

ErrUserAborted is returned when the user aborts an interactive prompt. This sentinel error normalizes various abort signals (Ctrl+C, Esc, Ctrl+D, etc.) into a single error that can be handled centrally.

Functions

func Confirm

func Confirm(message string) (bool, error)

func ConfirmRemoval

func ConfirmRemoval(count int) (bool, error)

func ConfirmSaveSyncConfig

func ConfirmSaveSyncConfig() (bool, error)

ConfirmSaveSyncConfig asks user if they want to save sync settings to anvil.yaml

func ConfirmScaffold

func ConfirmScaffold(branch string) (bool, error)

ConfirmScaffold prompts user to confirm scaffolding current worktree

func ConfirmSync

func ConfirmSync(currentBranch, upstream, strategy string) (bool, error)

ConfirmSync prompts user to confirm running sync operation

func IsAbort

func IsAbort(err error) bool

IsAbort returns true if the error represents a user abort.

func IsInteractive

func IsInteractive() bool

func NormalizeAbort

func NormalizeAbort(err error) error

NormalizeAbort converts known abort-like errors to ErrUserAborted. This includes huh.ErrUserAborted (Esc/Ctrl+C in huh prompts), io.EOF (Ctrl+D/closed stdin), and context.Canceled.

func PrintDone

func PrintDone(msg string)

func PrintError

func PrintError(msg string)

func PrintErrorWithHint

func PrintErrorWithHint(msg, hint string)

func PrintInfo

func PrintInfo(msg string)

func PrintStep

func PrintStep(msg string)

func PrintSuccess

func PrintSuccess(msg string)

func PrintSuccessPath

func PrintSuccessPath(msg, path string)

func PrintWarning

func PrintWarning(msg string)

func PromptNewBranch

func PromptNewBranch() (string, error)

func RenderStatusTable

func RenderStatusTable(rows [][]string) string

func RenderWorktreeTable

func RenderWorktreeTable(worktrees []git.Worktree) string

func RunWithSpinner

func RunWithSpinner(title string, action func() error) error

func SelectBranchInteractive

func SelectBranchInteractive(barePath string, localBranches, remoteBranches []string) (string, error)

func SelectSyncStrategy

func SelectSyncStrategy(defaultStrategy string) (string, error)

SelectSyncStrategy prompts user to choose between rebase and merge

func SelectUpstreamBranch

func SelectUpstreamBranch(localBranches, remoteBranches []string, defaultBranch string) (string, error)

SelectUpstreamBranch prompts user to select an upstream branch Defaults to the defaultBranch option if available

func SelectWorktreeToRemove

func SelectWorktreeToRemove(worktrees []git.Worktree) (*git.Worktree, error)

func SelectWorktreeToScaffold

func SelectWorktreeToScaffold(worktrees []git.Worktree) (*git.Worktree, error)

SelectWorktreeToScaffold allows selecting a worktree to scaffold

func SelectWorktreesToPrune

func SelectWorktreesToPrune(removable []git.Worktree) ([]git.Worktree, error)

func ShouldPrompt

func ShouldPrompt(cmd *cobra.Command, hasRequiredArgs bool) bool

Types

This section is empty.

Jump to

Keyboard shortcuts

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