Documentation ¶
Overview ¶
Package widget implements more complex user interface components on top of the primitives offered in the ui package.
Index ¶
- Variables
- type BranchSplit
- func (b *BranchSplit) Description() string
- func (b *BranchSplit) Err() error
- func (b *BranchSplit) Init() tea.Cmd
- func (b *BranchSplit) Render(w ui.Writer)
- func (b *BranchSplit) Selected() []int
- func (b *BranchSplit) Title() string
- func (b *BranchSplit) Update(msg tea.Msg) tea.Cmd
- func (b *BranchSplit) WithCommits(commits ...CommitSummary) *BranchSplit
- func (b *BranchSplit) WithDescription(desc string) *BranchSplit
- func (b *BranchSplit) WithHEAD(head string) *BranchSplit
- func (b *BranchSplit) WithTitle(title string) *BranchSplit
- type BranchSplitStyle
- type CommitSummary
- type CommitSummaryStyle
Constants ¶
This section is empty.
Variables ¶
var DefaultBranchSplitStyle = BranchSplitStyle{ Commit: DefaultCommitSummaryStyle, HeadCommit: DefaultCommitSummaryStyle.Faint(true), SplitMarker: ui.NewStyle().SetString("□"), HeadMarker: ui.NewStyle().SetString("■"), }
DefaultBranchSplitStyle is the default style for a BranchSplit.
var DefaultCommitSummaryStyle = CommitSummaryStyle{ Hash: ui.NewStyle().Foreground(ui.Yellow), Subject: ui.NewStyle().Foreground(ui.Plain), Time: ui.NewStyle().Foreground(ui.Gray), }
DefaultCommitSummaryStyle is the default style for rendering a CommitSummary.
Functions ¶
This section is empty.
Types ¶
type BranchSplit ¶
type BranchSplit struct { Style BranchSplitStyle // contains filtered or unexported fields }
BranchSplit is a widget that allows users to pick out commits to split from the current branch.
It displays a list of commits, the last of which is not selectable.
func NewBranchSplit ¶
func NewBranchSplit() *BranchSplit
NewBranchSplit creates a new BranchSplit widget.
func (*BranchSplit) Description ¶
func (b *BranchSplit) Description() string
Description returns the description of the widget.
func (*BranchSplit) Render ¶
func (b *BranchSplit) Render(w ui.Writer)
Render renders the widget to the given writer.
func (*BranchSplit) Selected ¶
func (b *BranchSplit) Selected() []int
Selected returns the indexes of the selected commits.
func (*BranchSplit) Title ¶
func (b *BranchSplit) Title() string
Title returns the title of the widget.
func (*BranchSplit) Update ¶
func (b *BranchSplit) Update(msg tea.Msg) tea.Cmd
Update updates the widget based on the message.
func (*BranchSplit) WithCommits ¶
func (b *BranchSplit) WithCommits(commits ...CommitSummary) *BranchSplit
WithCommits sets the commits to be listed in a branch split widget.
func (*BranchSplit) WithDescription ¶
func (b *BranchSplit) WithDescription(desc string) *BranchSplit
WithDescription sets the description of the widget.
func (*BranchSplit) WithHEAD ¶
func (b *BranchSplit) WithHEAD(head string) *BranchSplit
WithHEAD sets the name of the head commit: the last commit in the branch. This name, if present, is shown next to the head commit.
func (*BranchSplit) WithTitle ¶
func (b *BranchSplit) WithTitle(title string) *BranchSplit
WithTitle sets the title of the widget.
type BranchSplitStyle ¶
type BranchSplitStyle struct { Commit CommitSummaryStyle HeadCommit CommitSummaryStyle SplitMarker lipgloss.Style HeadMarker lipgloss.Style }
BranchSplitStyle defines the styles for BranchSplit.
type CommitSummary ¶
CommitSummary is the summary of a single commit.
func (*CommitSummary) Render ¶
func (c *CommitSummary) Render(w ui.Writer, style CommitSummaryStyle)
Render renders a CommitSummary to the given writer.
type CommitSummaryStyle ¶
CommitSummaryStyle is the style for rendering a CommitSummary.
func (CommitSummaryStyle) Faint ¶
func (s CommitSummaryStyle) Faint(f bool) CommitSummaryStyle
Faint returns a copy of the style with the faint attribute set to f.