Documentation
¶
Overview ¶
Package ui provides terminal UI components for wt command output.
This package is organized into subpackages by functionality:
Subpackages ¶
The UI package is structured as follows:
- [static]: Non-interactive output (tables, formatted text)
- [progress]: Progress indicators (spinners, progress bars)
- [prompt]: Simple interactive prompts (confirm, text input, select)
- [styles]: Shared lipgloss styles for visual consistency
- [wizard]: Multi-step interactive flows
Static Output ¶
Use [static.RenderTable] to render aligned tables:
import "github.com/raphi011/wt/internal/ui/static"
headers := []string{"NAME", "VALUE"}
rows := [][]string{{"foo", "bar"}, {"baz", "qux"}}
output := static.RenderTable(headers, rows)
Progress Indicators ¶
Use [progress.Spinner] for progress indication:
import "github.com/raphi011/wt/internal/ui/progress"
sp := progress.NewSpinner("Loading...")
sp.Start()
defer sp.Stop()
Simple Prompts ¶
Use [prompt] package for simple interactive prompts:
import "github.com/raphi011/wt/internal/ui/prompt"
result, err := prompt.Confirm("Continue?")
Wizard Flows ¶
For complex multi-step interactions, use the wizard subpackages:
- wizard/framework: Core wizard orchestration
- wizard/steps: Reusable step components (FilterableListStep, SingleSelectStep, TextInputStep)
- wizard/flows: Command-specific wizard implementations
Example usage:
import "github.com/raphi011/wt/internal/ui/wizard/flows" result, err := flows.CdInteractive(params) result, err := flows.CheckoutInteractive(params) result, err := flows.PruneInteractive(params)
Design Notes ¶
Output is designed for terminal display with:
- Monospace font assumptions
- ANSI color support
- Clear separation between static and interactive components
Directories
¶
| Path | Synopsis |
|---|---|
|
Package prompt provides simple interactive prompts.
|
Package prompt provides simple interactive prompts. |
|
Package static provides non-interactive terminal output components.
|
Package static provides non-interactive terminal output components. |
|
Package styles provides shared lipgloss styles for UI components.
|
Package styles provides shared lipgloss styles for UI components. |
|
wizard
|
|
|
flows
Package flows provides command-specific wizard implementations.
|
Package flows provides command-specific wizard implementations. |
|
framework
Package framework provides the core wizard orchestration system.
|
Package framework provides the core wizard orchestration system. |
|
steps
Package steps provides reusable step components for wizards.
|
Package steps provides reusable step components for wizards. |
Click to show internal directories.
Click to hide internal directories.