Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildAuthorList ¶
BuildAuthorList deduplicates all (may contain duplicates), sorts alphabetically, then prepends current as the first entry (removing it from its sorted position if present). If current is empty, the sorted deduplicated list is returned as-is.
func FillOutForm ¶
func FillOutForm( ctx context.Context, cfg *config.AppConfig, defaults tui.CommitOption, hs historyStore, initialPrefill map[string]any, ) ([]byte, tui.CommitOption, error)
FillOutForm presents the commit TUI form and orchestrates the ctrl+r history flow. hs must not be nil; pass a *store.Store opened from store.OpenRepo.
Exit conditions:
- form completed → saves payload to history, assembles and returns the commit message.
- ctrl+r → shows history picker, then re-opens form (pre-filled or blank).
- ctrl+c / esc → returns ("", zero, huh.ErrUserAborted).
Types ¶
type IssueHint ¶ added in v0.6.0
type IssueHint struct {
IssueID string
BranchType string
// Closing indicates this is a merge/close commit. When true, Prefill
// always sets footer to CloseFormat % id (if the footer field exists) and
// independently sets scope (if the scope field exists). When false, the
// fallback chain scope → footer (RefFormat % id) → subject is used instead.
Closing bool
}
IssueHint carries issue context detected from the current branch. Zero value means no issue branch — form fields are left unchanged.
func (IssueHint) Prefill ¶ added in v0.8.0
func (h IssueHint) Prefill(msgCfg config.CommitMessageConfig) map[string]any
Prefill returns the issue-hint contribution to a FillOutForm prefill map.
When Closing is false, IssueID populates one field using the fallback chain:
"scope" → "footer" (as msgCfg.RefFormat % id) → "subject" (as "(<id>)").
When Closing is true, footer always receives msgCfg.CloseFormat % id when present, scope independently receives id when present, and subject is the last resort when neither scope nor footer exist.
BranchType is emitted as "type" when non-empty; loadForm validates it against cfg.CommitTypes and silently ignores an unconfigured value.