tui

package
v0.0.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 14, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package tui provides a text-based user interface for the application.

Index

Constants

This section is empty.

Variables

View Source
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

func CommitMessageTextArea() (string, error)

CommitMessageTextArea is an entry function to interact with the text area model.

func MustPromptForInputTea

func MustPromptForInputTea(prompt string) string

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

func MustPromptWithChoices(question string, choices []string) string

MustPromptWithChoices prompts the user with multiple choices using Tea. Returns the selected choice as a string.

func MustPromptYesNoTea

func MustPromptYesNoTea(question string, defaultChoice bool) bool

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.

func SprinnerStop

func SprinnerStop()

SprinnerStop stops the running spinner.

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

func (m ChoiceModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

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

func (m InputModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

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

func (m SpinnerModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

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) Update

func (m TextAreModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update handles messages for updating the text area model.

func (TextAreModel) View

func (m TextAreModel) View() string

View method renders the current state of the model into a viewable string format.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL