Documentation
¶
Overview ¶
Package checkoutview renders the interactive stack picker shown by `gh stack checkout` when no target is given. It reconciles the locally tracked stacks with the stacks returned by the Stacks REST API into a single table, labels each as Local or Remote, and lets the user filter, search, and select one to check out.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model is the Bubble Tea model for the interactive checkout stack picker.
type StackRow ¶
type StackRow struct {
Number int // stack number; 0 when unknown (local-only, not pushed)
Type StackType
BottomBranch string
TopBranch string
Base string
Status StatusCounts
Created time.Time
HasCreated bool
// Branches is the full ordered list of branch names in the stack. Only
// BottomBranch and TopBranch are displayed; the complete list exists so
// search can match any branch, including mid-stack ones.
Branches []string
// LocalStack points at the local stack when Type == TypeLocal, so the caller
// can check out its branches directly without cloning. It is nil for
// remote-only rows, which are cloned by stack number instead.
LocalStack *stack.Stack
}
StackRow is a single reconciled entry shown in the checkout picker.
func BuildRows ¶
func BuildRows(local []stack.Stack, remote []github.RemoteStack) []StackRow
BuildRows reconciles the local stacks with the remote stacks into the ordered list shown in the picker. Local stacks own the "Local" type even when they are tracked on the remote; remote stacks with no local match are "Remote". Fully-merged stacks (every PR merged) are omitted. The local slice must be the caller's live stack slice, since rows retain pointers into it.
func (StackRow) CreatedDisplay ¶
CreatedDisplay renders the creation time as a compact age, or "—" when unknown.
func (StackRow) NumberDisplay ¶
NumberDisplay renders the stack number, or "—" when it is unknown.
type StatusCounts ¶
type StatusCounts struct {
Merged int // merged PRs (purple)
Open int // open, non-merged PRs (green)
Closed int // closed, non-merged PRs (red)
Unpushed int // branches with no PR yet (gray)
}
StatusCounts summarizes a stack's composition for the status bar. Each field is a count of branches/PRs in that state.
func (StatusCounts) Total ¶
func (c StatusCounts) Total() int
Total returns the number of branches/PRs represented.