tui

package
v0.13.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 9, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BranchActionNameList         = "branchList"
	BranchActionNameNew          = "branchNew"
	BranchActionNameMerge        = "branchMerge"
	BranchActionNamePrune        = "branchPrune"
	BranchActionNamePruneTracker = "branchPruneTracker"

	BranchTableHeaderColor = lipgloss.Color("63")
)
View Source
const (
	IssueActionNameStart = "issueStart"
	IssueActionNameList  = "issueList"
	IssueActionNameClose = "issueClose"
)

Variables

This section is empty.

Functions

func BaseBranchPicker added in v0.11.0

func BaseBranchPicker(defaultBase string, branches []string, selected *string) *huh.Group

BaseBranchPicker lets the user pick the base branch for a new issue branch. defaultBase is pre-selected. branches is the full list of local git branch names.

func BranchActionSelect

func BranchActionSelect(action *string) *huh.Group

BranchActionSelect presents the list of available branch actions.

func BranchConflictPicker added in v0.9.5

func BranchConflictPicker(branchName string, action *string) *huh.Group

BranchConflictPicker shows a 3-option picker when a deterministic branch name already exists locally. The selected value is stored in *action and is one of: "checkout", "variant", "abort".

func BranchPruneConfirm

func BranchPruneConfirm(nDeleted, nMerged int, confirmed *bool) *huh.Group

BranchPruneConfirm asks whether to proceed with pruning nDeleted deleted and nMerged merged branch records.

func BranchStatusFilter

func BranchStatusFilter(status *string, selected string) *huh.Group

BranchStatusFilter presents a status filter for the branch list. selected is the pre-selected value ("in_progress", "merged", "closed", or "all"); defaults to "in_progress" when empty.

func BranchTableModel added in v0.3.0

func BranchTableModel(rows []store.BranchRow) (tea.Model, error)

func CommitMessageGroup

func CommitMessageGroup(commitTypes []config.CommitTypeOption, items []config.CommitItem, selectedType *string) *huh.Group

CommitMessageGroup builds the first commit form group. The type select is always first, populated from commitTypes and writing into selectedType. Remaining fields come from items (scope, subject, body, footer).

func CommitOptionsGroup

func CommitOptionsGroup(opt *CommitOption) *huh.Group

CommitOptionsGroup builds the second commit form group (author + commit flags). opt is written directly by the form fields.

func ConfigDestPicker added in v0.5.0

func ConfigDestPicker(opts []huh.Option[string], dest *string) *huh.Group

ConfigDestPicker presents a select form for choosing where to write the config file. opts is built by the caller based on which paths already exist.

func ConfigSectionPicker added in v0.7.0

func ConfigSectionPicker(keys []string, selected *[]string) *huh.Group

ConfigSectionPicker returns a huh.Group with a MultiSelect that lets the user choose which config sections to write to the repo-local TOML file. keys is the ordered list of section names from the config map. selected is the pointer where chosen keys are written after the form runs.

func IssueActionSelect

func IssueActionSelect(action *string) *huh.Group

IssueActionSelect presents the list of available issue actions.

func IssueBranchPicker added in v0.4.2

func IssueBranchPicker(rows []store.BranchRow, currentBranch string, selected *store.BranchRow) *huh.Group

IssueBranchPicker presents in-progress branches for the close flow. The branch matching currentBranch is pre-selected; falls back to the first row.

func IssueConfirm

func IssueConfirm(confirmTitle string, confirmed *bool) *huh.Group

func IssueDeleteBranch added in v0.4.2

func IssueDeleteBranch(branchName string, confirmed *bool) *huh.Group

IssueDeleteBranch asks whether to delete the local branch after closing.

func IssueInput

func IssueInput(issueID, title, branchType *string, allowedBranchTypes []string) *huh.Group

func IssueMergeAuthor added in v0.4.2

func IssueMergeAuthor(authors []string, author *string) *huh.Group

IssueMergeAuthor lets the user pick the squash commit author. authors[0] is expected to be the git config identity (pre-filled by the caller).

func IssueMergeConfirm added in v0.4.2

func IssueMergeConfirm(branchName, baseBranch, strategy string, confirmed *bool) *huh.Group

IssueMergeConfirm shows a merge summary and asks for final confirmation.

func IssueMergeStrategy added in v0.4.2

func IssueMergeStrategy(selected *string, options []StrategyOption) *huh.Group

IssueMergeStrategy renders a single-select picker from the given options and writes the chosen Value to *selected. *selected is pre-populated with the first option's Value as the default.

func IssueStatusPicker added in v0.2.0

func IssueStatusPicker(issueID, trackerType string, statuses []string, selected *string) *huh.Group

IssueStatusPicker lets the user pick a new status from the live list, or skip the update entirely. selected is set to the chosen status name, or to issueStatusSkip ("") when the user chooses to skip.

func IssueTableModel added in v0.3.0

func IssueTableModel(rows []store.IssueRow, initialStatus string) (tea.Model, error)

func IssueTrackerError

func IssueTrackerError(msg string) *huh.Group

IssueTrackerError shows an error note with a "Continue with manual input" button.

func IssueTrackerPicker

func IssueTrackerPicker(
	issues []tracker.Issue,
	selected *tracker.Issue,
	branchTypes []string,
	branchType *string) *huh.Group

IssueTrackerPicker shows the live issue list and branch type selector.

func IssueTrackerToggle

func IssueTrackerToggle(useTracker *bool, trackerFirst bool, trackerType string) *huh.Group

IssueTrackerToggle asks whether to fetch issues from the tracker. trackerFirst=true pre-selects YES (used for `issue start`); trackerFirst=false pre-selects NO (used for `branch new`).

func PushConfirm added in v0.12.0

func PushConfirm(summary string, confirmed *bool) *huh.Group

PushConfirm asks whether to push a branch to the remote. summary is the preview line (e.g. `Push "feat-x" to origin?`). The caller seeds *confirmed to set the default selection.

func ReviewBranchPicker added in v0.11.0

func ReviewBranchPicker(title string, rows []store.BranchRow, currentSlug string, selected *store.BranchRow) *huh.Group

ReviewBranchPicker presents a branch list for review commands (request, approve, reject, sync). The branch whose IssueSlug matches currentSlug is pre-selected; falls back to the first row.

func ReviewIssueStartPicker added in v0.11.0

func ReviewIssueStartPicker(slugs []string, selected *string) *huh.Group

ReviewIssueStartPicker presents a list of issue slugs available to start reviewing. The first slug is pre-selected.

func StatusPanel added in v0.13.0

func StatusPanel(entries []git.StatusEntry, all, includeUntracked bool) string

StatusPanel renders entries as a bordered lipgloss panel titled "Current Git Status", grouped into colored sections. Returns "" when there are no entries.

When all is true (commit -a/--all), tracked worktree changes are shown under "Changes to be committed" instead of a separate "not staged" section, so the panel reflects what the commit will actually include. When includeUntracked is true (commit -u/--include-untracked), untracked files fold into "Changes to be committed" as "new file:" lines and the untracked section is omitted.

func StatusPanelReserveWidth added in v0.13.0

func StatusPanelReserveWidth(entries []git.StatusEntry) int

StatusPanelReserveWidth returns the widest the panel can render for these entries across every combination of the --all and --include-untracked re-classifications. The form reserves this so its width stays stable when either toggle flips the panel between layouts. Returns 0 when nothing shows.

func VariantLabelInput added in v0.9.5

func VariantLabelInput(label *string) *huh.Group

VariantLabelInput prompts for a variant label and validates inline that the input slugs to a non-empty value.

func WorktreeToggle added in v0.9.0

func WorktreeToggle(useWorktree *bool) *huh.Group

WorktreeToggle asks whether to create a git worktree or a plain branch. Pre-selected default is false (plain branch).

Types

type CommitOption

type CommitOption struct {
	Skip             bool
	Authors          []string
	Author           string
	All              bool
	Amend            bool
	NoVerify         bool
	Signoff          bool
	AllowEmpty       bool
	IncludeUntracked bool
}

CommitOption holds commit option values for the commit options group of the TUI. Used both as flag-derived defaults (input) and as user selections (output).

type FormRunner added in v0.8.0

type FormRunner struct {
	// contains filtered or unexported fields
}

FormRunner wraps a *huh.Form as a tea.Model to intercept ctrl+r before huh sees it, and to render an optional read-only "Current Git Status" panel to the right of the form.

The panel is recomputed on every render from a fixed working-tree snapshot (entries) and the form's live (--all, --include-untracked) values (classifyFn), so toggling either option re-classifies the panel in real time. reserveWidth is the widest the panel can be across all layouts, so the form width stays stable as the toggles flip. When entries is empty there is no panel.

func RunForm added in v0.8.0

func RunForm(form *huh.Form, entries []git.StatusEntry, classifyFn func() (bool, bool)) (*FormRunner, error)

RunForm runs form inside a bubbletea program. When entries is non-empty it renders a live "Current Git Status" panel to the right of the form, whose staged/unstaged split follows classifyFn (the form's live (--all, --include-untracked) values). Returns (runner, nil) on normal completion or ctrl+r; call runner.WantHistory() to distinguish. Returns (runner, huh.ErrUserAborted) on ctrl+c / esc.

func (*FormRunner) Init added in v0.8.0

func (r *FormRunner) Init() tea.Cmd

Init implements tea.Model.

func (*FormRunner) Update added in v0.8.0

func (r *FormRunner) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update implements tea.Model.

func (*FormRunner) View added in v0.8.0

func (r *FormRunner) View() string

View implements tea.Model. When a panel is present it is recomputed for the current --all value and joined to the right of the form; otherwise only the form is rendered.

The panel is only attached while the form is actually rendering something. huh returns an empty view once the form is quitting (completed or aborted); attaching the panel then would leave it as the program's final on-screen frame after the form closes.

func (*FormRunner) WantHistory added in v0.8.0

func (r *FormRunner) WantHistory() bool

WantHistory reports whether the user pressed ctrl+r during the form.

type StrategyOption added in v0.8.0

type StrategyOption struct {
	Value string
	Label string
	Hint  string
}

StrategyOption is one entry rendered by IssueMergeStrategy. The picker does not know what the strategies mean — callers own the option list.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL