Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrUserQuit = errors.New("user quit")
ErrUserQuit is returned by Run when the user chooses to quit without committing.
Functions ¶
func FormatMessage ¶
FormatMessage returns the message wrapped in display borders.
func Run ¶
Run displays the message and runs the interactive menu loop until the user accepts, quits, or an error occurs.
func RunSelector ¶
RunSelector displays an interactive file selector and returns the paths the user selected. It returns ErrUserQuit if the user cancels.
Types ¶
type Choice ¶
type Choice int
Choice represents what the user chose in the menu.
func ParseChoice ¶
ParseChoice interprets a single line of user input into a Choice. Single-char inputs are mapped to menu choices. Multi-char inputs are treated as inline message replacements.
type FileEntry ¶
type FileEntry struct {
Path string
Label string // single-char status: "M", "A", "D", "R", "?"
Selected bool
}
FileEntry is a display item for the file selector.
type RunOpts ¶
type RunOpts struct {
InitialMessage string
StagedFiles []string // files that will be committed
RegenerateFn func() (string, error) // called when user picks 'r'
EditFn func(string) (string, error) // called when user picks 'e'
CommitFn func(string) error // called when user picks 'a'
CommitAndPushFn func(string) error // called when user picks 'A'
}
RunOpts holds the dependencies for the UI loop.