Documentation
¶
Overview ¶
Package split provides a unified TUI component for split operations.
Index ¶
- Variables
- func GenerateDefaultCommitMessage(files []string, originalCommitMessage string) string
- type BranchCreatedMsg
- type BranchNameEnteredMsg
- type CancelMsg
- type CommitEditorConfig
- type CommitEditorModel
- type CompleteMsg
- type Config
- type Direction
- type DirectionContext
- type DirectionSelectedMsg
- type EditMessageConfirmedMsg
- type EditorCompleteMsg
- type EditorRequestMsg
- type ErrorMsg
- type HunksLoadedMsg
- type HunksSelectedMsg
- type KeyMap
- type LoopContinueMsg
- type Model
- func (m *Model) GetBranchName() string
- func (m *Model) GetCurrentState() State
- func (m *Model) GetCurrentSubState() SubState
- func (m *Model) GetResult() Result
- func (m *Model) GetSelectedDirection() Direction
- func (m *Model) GetSelectedStyle() Style
- func (m *Model) GetWantsEditMessage() bool
- func (m *Model) Init() tea.Cmd
- func (m *Model) IsCreatingBranch() bool
- func (m *Model) IsSelectingHunks() bool
- func (m *Model) IsWaitingForEditor() bool
- func (m *Model) SetCommitMessage(msg string)
- func (m *Model) SetDefaultBranchName(name string)
- func (m *Model) SetExistingBranchNames(names map[string]bool)
- func (m *Model) SetOriginalBranchName(name string)
- func (m *Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (m *Model) View() tea.View
- type NoChangesMsg
- type Result
- type RetryMsg
- type State
- type Style
- type Styles
- type SubState
- type TypeChoice
- type TypeSelectedMsg
Constants ¶
This section is empty.
Variables ¶
var DefaultKeyMap = KeyMap{ Up: key.NewBinding( key.WithKeys(core.KeyUp, "k"), key.WithHelp("↑/k", "up"), ), Down: key.NewBinding( key.WithKeys(core.KeyDown, "j"), key.WithHelp("↓/j", "down"), ), Select: key.NewBinding( key.WithKeys(core.KeyEnter), key.WithHelp("enter", "select"), ), Submit: key.NewBinding( key.WithKeys(core.KeyEnter), key.WithHelp("enter", "submit"), ), Yes: key.NewBinding( key.WithKeys("y", core.KeyEnter), key.WithHelp("y", "yes"), ), No: key.NewBinding( key.WithKeys("n"), key.WithHelp("n", "no"), ), Cancel: key.NewBinding( key.WithKeys(core.KeyCtrlC, core.KeyEsc), key.WithHelp("esc", "cancel"), ), }
DefaultKeyMap contains the default key bindings for the split wizard
Functions ¶
func GenerateDefaultCommitMessage ¶
GenerateDefaultCommitMessage generates a sensible default commit message based on the original commit message and files being extracted.
Format:
<original title> (split) <original body> * file1 * file2
Types ¶
type BranchCreatedMsg ¶
type BranchCreatedMsg struct {
Name string
}
BranchCreatedMsg indicates a branch was created
type BranchNameEnteredMsg ¶
type BranchNameEnteredMsg struct {
Name string
}
BranchNameEnteredMsg indicates user entered a branch name
type CommitEditorConfig ¶
type CommitEditorConfig struct {
// DefaultMessage is the initial commit message
DefaultMessage string
// Files being extracted (for context display)
Files []string
// Direction of the split (above/below)
Direction Direction
// CurrentBranch name for context
CurrentBranch string
}
CommitEditorConfig configures the commit message editor
type CommitEditorModel ¶
type CommitEditorModel struct {
// contains filtered or unexported fields
}
CommitEditorModel is a bubbletea model for editing commit messages It shows context and launches external EDITOR for editing
func NewCommitEditorModel ¶
func NewCommitEditorModel(cfg CommitEditorConfig) *CommitEditorModel
NewCommitEditorModel creates a new commit message editor model
func (*CommitEditorModel) Canceled ¶
func (m *CommitEditorModel) Canceled() bool
Canceled returns true if the user canceled the editor
func (*CommitEditorModel) Init ¶
func (m *CommitEditorModel) Init() tea.Cmd
Init implements tea.Model
func (*CommitEditorModel) Message ¶
func (m *CommitEditorModel) Message() string
Message returns the commit message entered by the user
func (*CommitEditorModel) View ¶
func (m *CommitEditorModel) View() tea.View
View implements tea.Model
type CompleteMsg ¶
type CompleteMsg struct {
Branches []string
}
CompleteMsg indicates split is complete
type Config ¶
type Config struct {
Engine engine.Engine
Branch engine.Branch
// PreselectedStyle skips type selection if set
PreselectedStyle Style
// PreselectedDirection skips direction selection if set
PreselectedDirection Direction
// UseGitAddP uses git add -p instead of TUI hunk selector
UseGitAddP bool
// AvailableTypes provides the type choices when style not preselected
AvailableTypes []TypeChoice
}
Config provides configuration for the split model
type Direction ¶
type Direction string
Direction specifies where the new branch should be placed Note: This mirrors split.Direction from actions/split to avoid import cycles.
type DirectionContext ¶
type DirectionContext struct {
Engine engine.BranchReader
CurrentBranch string
ParentBranch string
Children []string
}
DirectionContext provides context for the direction selection
type DirectionSelectedMsg ¶
type DirectionSelectedMsg struct {
Direction Direction
}
DirectionSelectedMsg indicates user selected a direction
type EditMessageConfirmedMsg ¶
type EditMessageConfirmedMsg struct {
WantsEdit bool
}
EditMessageConfirmedMsg indicates user responded to edit message prompt
type EditorCompleteMsg ¶
EditorCompleteMsg indicates external editor completed
type EditorRequestMsg ¶
type EditorRequestMsg struct {
DefaultMessage string
}
EditorRequestMsg indicates the model needs an external editor
type HunksLoadedMsg ¶
HunksLoadedMsg indicates hunks have been loaded for selection
type HunksSelectedMsg ¶
HunksSelectedMsg indicates user finished selecting hunks
type KeyMap ¶
type KeyMap struct {
Up key.Binding
Down key.Binding
Select key.Binding
Submit key.Binding
Yes key.Binding
No key.Binding
Cancel key.Binding
}
KeyMap defines unified key bindings for the split wizard
func (KeyMap) ConfirmHelp ¶
ConfirmHelp returns key bindings for confirmation prompts
func (KeyMap) SubmitHelp ¶
SubmitHelp returns key bindings for submit prompts
type LoopContinueMsg ¶
type LoopContinueMsg struct{}
LoopContinueMsg indicates the hunk loop should continue
type Model ¶
Model is the unified TUI model for the split wizard. It implements a state machine that guides the user through: 1. Selecting split type (if not preselected) 2. Selecting direction (if not preselected) 3. The hunk selection loop (select hunks → branch name → commit message → create)
func (*Model) GetBranchName ¶
GetBranchName returns the current branch name input value
func (*Model) GetCurrentState ¶
GetCurrentState returns the current state
func (*Model) GetCurrentSubState ¶
GetCurrentSubState returns the current sub-state
func (*Model) GetSelectedDirection ¶
GetSelectedDirection returns the selected direction
func (*Model) GetSelectedStyle ¶
GetSelectedStyle returns the selected style
func (*Model) GetWantsEditMessage ¶
GetWantsEditMessage returns whether user wants to edit the message
func (*Model) IsCreatingBranch ¶
IsCreatingBranch returns true if the model is creating a branch
func (*Model) IsSelectingHunks ¶
IsSelectingHunks returns true if the model is in hunk selection state
func (*Model) IsWaitingForEditor ¶
IsWaitingForEditor returns true if the model is waiting for external editor
func (*Model) SetCommitMessage ¶
SetCommitMessage sets the default commit message
func (*Model) SetDefaultBranchName ¶
SetDefaultBranchName sets the default branch name for the next branch
func (*Model) SetExistingBranchNames ¶
SetExistingBranchNames sets the map of existing branch names for validation
func (*Model) SetOriginalBranchName ¶
SetOriginalBranchName sets the original branch name (allowed to reuse)
type Style ¶
type Style string
Style specifies the split mode Note: This mirrors split.Style from actions/split to avoid import cycles. Callers convert between the two types.
type Styles ¶
type Styles struct {
Header style.HeaderStyles
Selection style.SelectionStyles
Status style.StatusStyles
Common style.CommonStyles
Layout style.LayoutStyles
Icons style.StatusIcons
}
Styles contains styling for the split component using shared style types
func DefaultStyles ¶
func DefaultStyles() Styles
DefaultStyles returns the default styles for the split component
type TypeChoice ¶
TypeChoice represents an available split type option
type TypeSelectedMsg ¶
type TypeSelectedMsg struct {
Style Style
}
TypeSelectedMsg indicates user selected a split type