Documentation
¶
Overview ¶
Package tui holds the full-screen terminal editors.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func OpenBrowser ¶
OpenBrowser opens url with the system's opener.
Types ¶
type Item ¶
type Item struct {
Title string
Detail string
Tab int // index into Picker.Tabs; ignored without tabs
}
Item is one entry in a Picker.
type ModifyEditor ¶
type ModifyEditor struct {
Nodes []*ModifyNode
Applied bool
// Details returns text for the f (files) and c (commits) panels.
Details func(branch, kind string) string
// ValidName, if set, checks a new or renamed layer's name (orig is the
// layer's original branch, "" for an inserted one) and returns why it is
// unusable, or "". Names are checked here so that the staged changes
// survive a bad name.
ValidName func(name, orig string) string
// contains filtered or unexported fields
}
ModifyEditor stages structural changes to a stack. Nodes are bottom first.
func NewModifyEditor ¶
func NewModifyEditor(nodes []*ModifyNode) *ModifyEditor
NewModifyEditor returns an editor focused on the top layer.
func (*ModifyEditor) Init ¶
func (e *ModifyEditor) Init() tea.Cmd
func (*ModifyEditor) View ¶
func (e *ModifyEditor) View() string
type ModifyNode ¶
type ModifyNode struct {
Name string
Orig string // original branch, "" for an inserted layer
Sources []string // original layers whose commits this layer holds
Commits int // commit count of the original layer (for display)
Dropped bool
}
ModifyNode is one layer in the modify editor.
type Picker ¶
type Picker struct {
Title string
Tabs []string
Items []Item
Initial int // item index to start on
Chosen int // index into Items, -1 when cancelled
// contains filtered or unexported fields
}
Picker is a searchable list with optional tabs. The first tab, if any, shows every item.
type SubmitEditor ¶
type SubmitEditor struct {
Nodes []*SubmitNode
Submitted bool
Cancelled bool
LinkOnly bool // ^b: only link the existing PRs
// OpenURL opens a URL in the browser (^o).
OpenURL func(url string) error
// Ref formats a CR number, e.g. "!12"; nil writes "#12".
Ref func(n int) string
// CR names a change request, e.g. "MR"; "" is "PR".
CR string
// contains filtered or unexported fields
}
SubmitEditor lets the user pick which branches become PRs and edit their title, description and draft state. Nodes are ordered bottom first.
func NewSubmitEditor ¶
func NewSubmitEditor(nodes []*SubmitNode) *SubmitEditor
NewSubmitEditor returns an editor focused on the topmost branch.
func (*SubmitEditor) Init ¶
func (e *SubmitEditor) Init() tea.Cmd
func (*SubmitEditor) View ¶
func (e *SubmitEditor) View() string
type SubmitNode ¶
type SubmitNode struct {
Branch string
Target string
// Existing PR, if any (Number > 0). Existing PRs are always kept.
Number int
URL string
State string // "open", "draft", ...
// For new PRs: the editable draft.
Include bool
Title string
Body string
Draft bool
}
SubmitNode is one branch in the submit editor.