Documentation
¶
Index ¶
- type Builder
- func (b *Builder) AutoDetect() *Builder
- func (b *Builder) Build() *Collection
- func (b *Builder) WithCustom(key, value string) *Builder
- func (b *Builder) WithEnvVars(names []string) *Builder
- func (b *Builder) WithHistory(commands []string) *Builder
- func (b *Builder) WithHistoryLimit(commands []string, limit int) *Builder
- func (b *Builder) WithLastError(stderr string) *Builder
- func (b *Builder) WithLastOutput(output string) *Builder
- type Category
- type Collection
- func (c *Collection) Add(item Item)
- func (c *Collection) Clear()
- func (c *Collection) DeselectAll()
- func (c *Collection) SelectAll()
- func (c *Collection) SelectedItems() []Item
- func (c *Collection) SelectedSize() int
- func (c *Collection) Serialize() string
- func (c *Collection) SizeStatus() string
- func (c *Collection) Toggle(index int)
- type Item
- type Picker
- func (p *Picker) Collection() *Collection
- func (p *Picker) CurrentItem() *Item
- func (p *Picker) Cursor() int
- func (p *Picker) DeselectAll()
- func (p *Picker) ItemCount() int
- func (p *Picker) MoveDown()
- func (p *Picker) MoveUp()
- func (p *Picker) Reset()
- func (p *Picker) SelectAll()
- func (p *Picker) SelectedSize() int
- func (p *Picker) Serialize() string
- func (p *Picker) SizeStatus() string
- func (p *Picker) ToggleCurrent()
- type PickerUI
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder builds a context collection from various sources.
func (*Builder) AutoDetect ¶
AutoDetect adds auto-detected context items (cwd, git branch, k8s context).
func (*Builder) WithCustom ¶
WithCustom adds a custom context item.
func (*Builder) WithEnvVars ¶
WithEnvVars adds environment variables.
func (*Builder) WithHistory ¶
WithHistory adds command history items.
func (*Builder) WithHistoryLimit ¶
WithHistoryLimit adds command history items with a limit.
func (*Builder) WithLastError ¶
WithLastError adds the last command error.
func (*Builder) WithLastOutput ¶
WithLastOutput adds the last command output.
type Collection ¶
Collection holds all available context items.
func NewCollection ¶
func NewCollection() *Collection
NewCollection creates a new context collection.
func (*Collection) Clear ¶
func (c *Collection) Clear()
Clear removes all items from the collection.
func (*Collection) DeselectAll ¶
func (c *Collection) DeselectAll()
DeselectAll deselects all items.
func (*Collection) SelectedItems ¶
func (c *Collection) SelectedItems() []Item
SelectedItems returns only selected items.
func (*Collection) SelectedSize ¶
func (c *Collection) SelectedSize() int
SelectedSize returns the total size of selected items.
func (*Collection) Serialize ¶
func (c *Collection) Serialize() string
Serialize returns the selected context as a string.
func (*Collection) SizeStatus ¶
func (c *Collection) SizeStatus() string
SizeStatus returns a status indicator for the current size. Returns "green", "yellow", or "red".
func (*Collection) Toggle ¶
func (c *Collection) Toggle(index int)
Toggle toggles selection of an item by index.
type Item ¶
type Item struct {
Category Category
Key string // Display key (e.g., "kubectl get pods" or "HOME")
Value string // Full value to include in context
Selected bool // Whether to include in context
SizeBytes int // Size in bytes when serialized
}
Item represents a single context item.
type Picker ¶
type Picker struct {
// contains filtered or unexported fields
}
Picker provides an interactive context picker.
func NewPicker ¶
func NewPicker(collection *Collection) *Picker
NewPicker creates a new context picker.
func (*Picker) Collection ¶
func (p *Picker) Collection() *Collection
Collection returns the underlying collection.
func (*Picker) CurrentItem ¶
CurrentItem returns the currently selected item, or nil if empty.
func (*Picker) SelectedSize ¶
SelectedSize returns the size of selected items.
func (*Picker) SizeStatus ¶
SizeStatus returns the size status indicator.
func (*Picker) ToggleCurrent ¶
func (p *Picker) ToggleCurrent()
ToggleCurrent toggles selection of the current item.
type PickerUI ¶
type PickerUI struct {
// contains filtered or unexported fields
}
PickerUI provides an interactive context picker TUI.
func NewPickerUI ¶
func NewPickerUI(collection *Collection) *PickerUI
NewPickerUI creates a new picker UI.
func (*PickerUI) Run ¶
Run starts the interactive picker and returns the serialized context. Returns empty string if canceled.