Documentation ¶
Overview ¶
Package tui provides a text-based user interface for the application.
Index ¶
- Variables
- func CommitMessageTextArea() (string, error)
- func MustPromptForInputTea(prompt string) string
- func MustPromptWithChoices(question string, choices []string) string
- func MustPromptYesNoTea(question string, defaultChoice bool) bool
- func SprinnerStart(text string)
- func SprinnerStop()
- type ChoiceModel
- type InputModel
- type SpinnerModel
- type TextAreModel
Constants ¶
This section is empty.
Variables ¶
var ( ChoiceStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("#FFFFFF")) CursorStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("#00FF00")) HintStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("#767676")) InputStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("#00FF00")) QuestionStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("#FF06B7")).Bold(true) )
Style definitions.
Functions ¶
func CommitMessageTextArea ¶
CommitMessageTextArea is an entry function to interact with the text area model.
func MustPromptForInputTea ¶
MustPromptForInputTea prompts the user for input using the BubbleTea framework. This function encapsulates the process of setting up, running, and managing the life cycle of the prompt.
func MustPromptWithChoices ¶
MustPromptWithChoices prompts the user with multiple choices using Tea. Returns the selected choice as a string.
func MustPromptYesNoTea ¶
MustPromptYesNoTea prompts a yes/no question using Tea. Returns true for 'Yes' and false for 'No'.
func SprinnerStart ¶
func SprinnerStart(text string)
SprinnerStart starts the spinner with the given text.
Types ¶
type ChoiceModel ¶
type ChoiceModel struct {
// contains filtered or unexported fields
}
ChoiceModel holds the state for multiple-choice prompts. It manages the current selection, the list of choices, and the specific question being asked.
func (ChoiceModel) Init ¶
func (m ChoiceModel) Init() tea.Cmd
Init initializes the model. Returns a command but does nothing initially.
func (ChoiceModel) Update ¶
Update processes incoming messages and updates the model based on user input. Handles key presses to navigate and select from the choices.
func (ChoiceModel) View ¶
func (m ChoiceModel) View() string
View renders the UI components, showing the question and the list of choices.
type InputModel ¶
type InputModel struct {
// contains filtered or unexported fields
}
InputModel holds the state for text input prompts. It manages the text input field, any potential error state, the prompt message, and the final user input.
func (InputModel) Init ¶
func (m InputModel) Init() tea.Cmd
Init initializes the input model for the Tea framework. Here, it sets up the text input blinking for user interaction.
func (InputModel) Update ¶
Update serves as the state update function for the Tea framework. It processes incoming messages, which often stem from user input.
func (InputModel) View ¶
func (m InputModel) View() string
View returns the string that represents the current View of the program. It provides the prompt, the user input area, and a hint for submission.
type SpinnerModel ¶
type SpinnerModel struct {
// contains filtered or unexported fields
}
SpinnerModel contains the state and behavior of the spinner.
func (SpinnerModel) Init ¶
func (m SpinnerModel) Init() tea.Cmd
Init initializes the spinner, returning its initial command for starting the tick loop.
func (SpinnerModel) Update ¶
Update handles messages for spinner updates and potential quit requests.
func (SpinnerModel) View ¶
func (m SpinnerModel) View() string
View renders the spinner and associated text to be displayed.
type TextAreModel ¶
type TextAreModel struct {
// contains filtered or unexported fields
}
Define a model for managing the state of the text area.
func (TextAreModel) Init ¶
func (m TextAreModel) Init() tea.Cmd
Init initializes the text area model for the Tea framework.
func (TextAreModel) View ¶
func (m TextAreModel) View() string
View method renders the current state of the model into a viewable string format.