Documentation
¶
Overview ¶
Package interactive houses interactive UI types and helpers shared across the application.
Package interactive houses interactive UI types and helpers shared across the application.
Package interactive houses interactive UI types and helpers shared across the application.
Package interactive houses interactive UI types and helpers shared across the application.
Package interactive houses interactive UI types and helpers shared across the application.
Package interactive houses interactive UI types and helpers shared across the application.
Index ¶
- Variables
- func Run(gitClient git.StatusInfoReader) []string
- type ANSIColors
- type CommandInfo
- type CommandRouter
- type GitStatus
- type KeyHandler
- type Renderer
- type UI
- func (ui *UI) AddToWorkflow(command string, args []string, description string) int
- func (ui *UI) ApplyContextualKeybindings(contextual *kb.ContextualKeyBindingMap)
- func (ui *UI) ClearWorkflow()
- func (ui *UI) ExecuteWorkflow() error
- func (ui *UI) ResetToSearchMode() bool
- func (ui *UI) Run() []string
- func (ui *UI) ToggleWorkflowView()
- type UIMode
- type UIState
- func (s *UIState) AddRune(r rune)
- func (s *UIState) ClearInput()
- func (s *UIState) DeleteToEnd()
- func (s *UIState) DeleteWord()
- func (s *UIState) EnterContext(newContext kb.Context)
- func (s *UIState) ExitContext()
- func (s *UIState) FocusInput()
- func (s *UIState) FocusWorkflowList()
- func (s *UIState) GetCurrentContext() kb.Context
- func (s *UIState) GetSelectedCommand() *CommandInfo
- func (s *UIState) HasInput() bool
- func (s *UIState) HasMatches() bool
- func (s *UIState) IsInInputMode() bool
- func (s *UIState) IsInResultsMode() bool
- func (s *UIState) IsInSearchMode() bool
- func (s *UIState) IsInputFocused() bool
- func (s *UIState) IsWorkflowMode() bool
- func (s *UIState) MoveDown()
- func (s *UIState) MoveLeft()
- func (s *UIState) MoveRight()
- func (s *UIState) MoveToBeginning()
- func (s *UIState) MoveToEnd()
- func (s *UIState) MoveUp()
- func (s *UIState) MoveWordLeft()
- func (s *UIState) MoveWordRight()
- func (s *UIState) RemoveChar()
- func (s *UIState) SetContext(ctx kb.Context)
- func (s *UIState) SetMode(mode UIMode)
- func (s *UIState) SetWorkflowListIndex(idx, total int)
- func (s *UIState) UpdateFiltered()
- type Workflow
- type WorkflowExecutor
- type WorkflowFocus
- type WorkflowManager
- func (m *WorkflowManager) AddStep(id int, command string, args []string, description string) (int, bool)
- func (m *WorkflowManager) ClearWorkflow(id int) bool
- func (m *WorkflowManager) CloneWorkflow(id int, name string) (int, bool)
- func (m *WorkflowManager) CreateWorkflow(name string) int
- func (m *WorkflowManager) CycleActive(delta int) int
- func (m *WorkflowManager) DeleteWorkflow(id int) (int, bool)
- func (m *WorkflowManager) GetActiveID() int
- func (m *WorkflowManager) GetWorkflow(id int) (*Workflow, bool)
- func (m *WorkflowManager) ListWorkflows() []WorkflowSummary
- func (m *WorkflowManager) LoadFromConfig(workflows map[string][]string)
- func (m *WorkflowManager) SetActive(id int) bool
- type WorkflowStep
- type WorkflowSummary
Constants ¶
This section is empty.
Variables ¶
var ErrWorkflowCanceled = errors.New("workflow canceled")
ErrWorkflowCanceled indicates the workflow was aborted by the user via soft cancel.
Functions ¶
func Run ¶
func Run(gitClient git.StatusInfoReader) []string
Run executes the incremental search interactive UI with the provided custom git client, and returns the selected command as []string (or nil if nothing is selected).
Types ¶
type ANSIColors ¶
type ANSIColors = uiutil.ANSIColors
ANSIColors is an alias to the shared UI palette definition.
func NewANSIColors ¶
func NewANSIColors() *ANSIColors
NewANSIColors exposes the shared ANSI color palette helper.
type CommandInfo ¶
CommandInfo contains the name and description of a command available in interactive mode. The list is injected at construction time via NewUI so that this package does not depend on the cmd layer.
type CommandRouter ¶
CommandRouter represents an interface for routing commands
type GitStatus ¶
type GitStatus struct {
Branch string
Modified int
Staged int
Ahead int
Behind int
HasChanges bool
}
GitStatus represents the current Git repository status
type KeyHandler ¶
type KeyHandler struct {
// contains filtered or unexported fields
}
KeyHandler manages keyboard input processing
func (*KeyHandler) GetCurrentKeyMap ¶
func (h *KeyHandler) GetCurrentKeyMap() *kb.KeyBindingMap
GetCurrentKeyMap returns the appropriate keybinding map for the current context
type Renderer ¶
type Renderer struct {
// contains filtered or unexported fields
}
Renderer handles all terminal rendering operations
type UI ¶
type UI struct {
// contains filtered or unexported fields
}
UI represents the interface for terminal UI operations
func NewUI ¶
func NewUI(gitClient git.StatusInfoReader, commands []CommandInfo, cfg *config.Config, router ...CommandRouter) *UI
NewUI creates a new UI with the provided git client, command list, optional pre-loaded config, and optional command router. commands is the list of entries shown in interactive search; pass nil to start with an empty list. Pass cfg=nil to have NewUI load configuration from gitClient (fallback path used by the standalone Run helper).
func (*UI) AddToWorkflow ¶
AddToWorkflow adds a command to the active workflow.
func (*UI) ApplyContextualKeybindings ¶
func (ui *UI) ApplyContextualKeybindings(contextual *kb.ContextualKeyBindingMap)
ApplyContextualKeybindings updates the active keybinding map, satisfying keybindings.ContextualMapApplier.
func (*UI) ClearWorkflow ¶
func (ui *UI) ClearWorkflow()
ClearWorkflow removes all steps from the workflow
func (*UI) ExecuteWorkflow ¶
ExecuteWorkflow executes the current workflow
func (*UI) ResetToSearchMode ¶
ResetToSearchMode clears the interactive search UI back to its default state.
func (*UI) ToggleWorkflowView ¶
func (ui *UI) ToggleWorkflowView()
ToggleWorkflowView toggles between search mode and workflow mode.
type UIState ¶
type UIState struct {
// contains filtered or unexported fields
}
UIState holds the current state of the interactive UI
func (*UIState) DeleteToEnd ¶
func (s *UIState) DeleteToEnd()
DeleteToEnd deletes from cursor to end of line (Ctrl+K)
func (*UIState) DeleteWord ¶
func (s *UIState) DeleteWord()
DeleteWord deletes word before cursor (Ctrl+W)
func (*UIState) EnterContext ¶
EnterContext pushes the current context onto the stack and switches to the new context
func (*UIState) ExitContext ¶
func (s *UIState) ExitContext()
ExitContext pops the previous context from the stack
func (*UIState) FocusInput ¶
func (s *UIState) FocusInput()
FocusInput moves focus to the command input/results pane.
func (*UIState) FocusWorkflowList ¶
func (s *UIState) FocusWorkflowList()
FocusWorkflowList moves focus to the workflow list pane.
func (*UIState) GetCurrentContext ¶
GetCurrentContext returns the current UI context
func (*UIState) GetSelectedCommand ¶
func (s *UIState) GetSelectedCommand() *CommandInfo
GetSelectedCommand returns the currently selected command
func (*UIState) HasMatches ¶
HasMatches returns true if there are filtered matches
func (*UIState) IsInInputMode ¶
IsInInputMode returns true if currently in input context
func (*UIState) IsInResultsMode ¶
IsInResultsMode returns true if currently in results context
func (*UIState) IsInSearchMode ¶
IsInSearchMode returns true if currently in search context
func (*UIState) IsInputFocused ¶
IsInputFocused reports whether the command input/results pane has focus.
func (*UIState) IsWorkflowMode ¶
IsWorkflowMode reports whether the UI is currently in workflow mode.
func (*UIState) MoveToBeginning ¶
func (s *UIState) MoveToBeginning()
MoveToBeginning moves cursor to beginning of line (Ctrl+A)
func (*UIState) MoveToEnd ¶
func (s *UIState) MoveToEnd()
MoveToEnd moves cursor to end of line (Ctrl+E)
func (*UIState) MoveWordLeft ¶
func (s *UIState) MoveWordLeft()
MoveWordLeft moves cursor to the beginning of the previous word
func (*UIState) MoveWordRight ¶
func (s *UIState) MoveWordRight()
MoveWordRight moves cursor to the start of the next word
func (*UIState) RemoveChar ¶
func (s *UIState) RemoveChar()
RemoveChar removes character before cursor (backspace)
func (*UIState) SetContext ¶
SetContext directly sets the context (use with caution)
func (*UIState) SetWorkflowListIndex ¶
SetWorkflowListIndex sets and clamps the workflow list selection.
func (*UIState) UpdateFiltered ¶
func (s *UIState) UpdateFiltered()
UpdateFiltered updates the filtered commands based on current input using fuzzy matching
type Workflow ¶
type Workflow struct {
// contains filtered or unexported fields
}
Workflow manages a sequence of commands to be executed
func (*Workflow) GetSteps ¶
func (w *Workflow) GetSteps() []WorkflowStep
GetSteps returns a copy of all workflow steps
type WorkflowExecutor ¶
type WorkflowExecutor struct {
// contains filtered or unexported fields
}
WorkflowExecutor executes workflow steps sequentially using existing Route mechanism
func NewWorkflowExecutor ¶
func NewWorkflowExecutor(router CommandRouter, ui *UI) *WorkflowExecutor
NewWorkflowExecutor creates a new workflow executor
func (*WorkflowExecutor) Execute ¶
func (we *WorkflowExecutor) Execute(workflow *Workflow) error
Execute runs all steps in the workflow sequentially
type WorkflowFocus ¶
type WorkflowFocus int
WorkflowFocus indicates which pane in workflow mode has focus.
const ( // FocusInput targets the command input/results pane. FocusInput WorkflowFocus = iota // FocusWorkflowList targets the workflow list pane. FocusWorkflowList )
type WorkflowManager ¶
type WorkflowManager struct {
// contains filtered or unexported fields
}
WorkflowManager manages multiple workflows and their lifecycle.
func NewWorkflowManager ¶
func NewWorkflowManager() *WorkflowManager
NewWorkflowManager constructs a manager with an initial empty workflow.
func (*WorkflowManager) AddStep ¶
func (m *WorkflowManager) AddStep(id int, command string, args []string, description string) (int, bool)
AddStep adds a step to the specified workflow.
func (*WorkflowManager) ClearWorkflow ¶
func (m *WorkflowManager) ClearWorkflow(id int) bool
ClearWorkflow removes all steps from the specified workflow.
func (*WorkflowManager) CloneWorkflow ¶
func (m *WorkflowManager) CloneWorkflow(id int, name string) (int, bool)
CloneWorkflow duplicates an existing workflow into a new dynamic workflow.
func (*WorkflowManager) CreateWorkflow ¶
func (m *WorkflowManager) CreateWorkflow(name string) int
CreateWorkflow adds a new empty workflow and makes it active.
func (*WorkflowManager) CycleActive ¶
func (m *WorkflowManager) CycleActive(delta int) int
CycleActive moves the active workflow by delta in the ordered list.
func (*WorkflowManager) DeleteWorkflow ¶
func (m *WorkflowManager) DeleteWorkflow(id int) (int, bool)
DeleteWorkflow removes a workflow by ID, returning the new active workflow ID.
func (*WorkflowManager) GetActiveID ¶
func (m *WorkflowManager) GetActiveID() int
GetActiveID returns the current active workflow ID.
func (*WorkflowManager) GetWorkflow ¶
func (m *WorkflowManager) GetWorkflow(id int) (*Workflow, bool)
GetWorkflow returns the workflow and whether it exists.
func (*WorkflowManager) ListWorkflows ¶
func (m *WorkflowManager) ListWorkflows() []WorkflowSummary
ListWorkflows returns ordered summaries of all workflows.
func (*WorkflowManager) LoadFromConfig ¶ added in v8.2.0
func (m *WorkflowManager) LoadFromConfig(workflows map[string][]string)
LoadFromConfig registers pre-defined workflows from the config's workflows section. Each map key becomes the workflow name; each string in the slice becomes a step where the first whitespace-delimited token is the command and the remainder are arguments. Interactive placeholder syntax (<name>) is supported and preserved in the step description.
Workflows are inserted in alphabetical order by name so that the order shown in ListWorkflows / the UI cycling key is stable and predictable across runs.
The scratch workflow that was active before the call is restored as active afterwards so the user can start typing immediately in the UI.
func (*WorkflowManager) SetActive ¶
func (m *WorkflowManager) SetActive(id int) bool
SetActive designates the workflow with the provided ID as active.
type WorkflowStep ¶
type WorkflowStep struct {
ID int `json:"id"`
Command string `json:"command"`
Args []string `json:"args"`
Description string `json:"description"`
}
WorkflowStep represents a single step in a workflow
func (*WorkflowStep) String ¶
func (ws *WorkflowStep) String() string
String returns a string representation of the workflow step
Source Files
¶
- fuzzy.go
- git_status.go
- input_editor.go
- input_escape.go
- input_state.go
- input_unicode.go
- keys.go
- keys_control.go
- keys_csi.go
- keys_escape.go
- keys_input.go
- keys_navigation.go
- keys_workflow.go
- render.go
- render_header.go
- render_search.go
- render_status.go
- render_workflow.go
- state.go
- ui.go
- ui_commands.go
- ui_mode.go
- ui_output.go
- ui_run.go
- ui_workflow.go
- workflow.go
- workflow_executor.go
- workflow_manager.go
- workflow_placeholders.go
- workflow_step.go