Documentation
¶
Overview ¶
Package ui provides styled terminal output and interactive prompts.
Index ¶
- Variables
- func Code(s string) string
- func ConfirmDelete(name, id string, repos []DeleteRepo) (bool, error)
- func ConfirmReset(filePath string) (bool, error)
- func Error(msg string)
- func Errorf(format string, a ...any)
- func Info(msg string)
- func Print(msg string)
- func Printf(format string, a ...any)
- func RelativeTime(t time.Time) string
- func RunWithSpinner(title string, op SpinnerOp) error
- func SelectAgent(agents []AgentOption) (string, error)
- func SelectWorkspace(matches []WorkspaceOption) (string, error)
- func SetPlain(v bool)
- func Success(msg string)
- func Table(headers []string, rows [][]string) string
- func Truncate(s string, maxLen int) string
- func Warning(msg string)
- type AgentOption
- type DeleteRepo
- type SpinnerOp
- type WorkspaceOption
Constants ¶
This section is empty.
Variables ¶
var ErrInterrupted = errors.New("interrupted")
ErrInterrupted is returned when the spinner is cancelled via ctrl+c.
Functions ¶
func ConfirmDelete ¶
func ConfirmDelete(name, id string, repos []DeleteRepo) (bool, error)
ConfirmDelete prompts the user to confirm workspace deletion.
func ConfirmReset ¶ added in v1.0.0
ConfirmReset prompts the user to confirm resetting a file to its default value.
func RelativeTime ¶
RelativeTime returns a human-friendly relative time string.
func RunWithSpinner ¶
RunWithSpinner runs op while displaying an animated spinner in TTY mode. In non-TTY mode it falls back to plain text output.
func SelectAgent ¶ added in v1.0.0
func SelectAgent(agents []AgentOption) (string, error)
SelectAgent prompts the user to choose among multiple configured agents. Returns the selected agent's exec command.
func SelectWorkspace ¶
func SelectWorkspace(matches []WorkspaceOption) (string, error)
SelectWorkspace prompts the user to choose among multiple matching workspaces. Returns the selected workspace's ID.
Types ¶
type AgentOption ¶ added in v1.0.0
AgentOption represents an agent choice for interactive selection.
type DeleteRepo ¶
DeleteRepo holds repo display info for the delete confirmation prompt.