ui

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Colors for different message types
	Success = color.New(color.FgGreen, color.Bold)
	Error   = color.New(color.FgRed, color.Bold)
	Warning = color.New(color.FgYellow, color.Bold)
	Info    = color.New(color.FgCyan, color.Bold)
	Accent  = color.New(color.FgMagenta, color.Bold)
	Dim     = color.New(color.FgHiBlack)

	// Emojis with colors
	MateEmoji    = "🧉"
	SuccessEmoji = Success.Sprint("✅")
	WarningEmoji = Warning.Sprint("⚠️")
	InfoEmoji    = Info.Sprint("ℹ️")
	RocketEmoji  = Accent.Sprint("🚀")
	StatsEmoji   = Accent.Sprint("📊")
)

Functions

func AskConfirmation

func AskConfirmation(question string) bool

func EditCommitMessage

func EditCommitMessage(initialMessage string, editorErrorMsg string) (string, error)

EditCommitMessage opens an editor for the user to edit the message

func HandleAppError

func HandleAppError(err error, translations ...*i18n.Translations)

HandleAppError handles an application error and displays it in a friendly way. If translations is nil, it will use English defaults.

func PrintDuration

func PrintDuration(msg string, duration time.Duration)

func PrintError

func PrintError(w io.Writer, msg string)

func PrintErrorWithSuggestion

func PrintErrorWithSuggestion(errMsg, suggestion string)

func PrintInfo

func PrintInfo(msg string)

func PrintKeyValue

func PrintKeyValue(key, value string)

func PrintSectionBanner

func PrintSectionBanner(title string)

func PrintSuccess

func PrintSuccess(w io.Writer, msg string)

func PrintTokenUsage

func PrintTokenUsage(usage *models.TokenUsage, t *i18n.Translations)

func PrintWarning

func PrintWarning(msg string)

func ResumeSuspendedSpinner

func ResumeSuspendedSpinner()

ResumeSuspendedSpinner resumes the previously suspended spinner.

func ShowDiff

func ShowDiff(files []string) error

func ShowDiffStats

func ShowDiffStats(files []string, headerMessage string) error

ShowDiffStats shows change statistics (like git diff --stat)

func ShowFilesTree

func ShowFilesTree(files []string, headerMessage string) error

ShowFilesTree shows modified files in tree format

func StopActiveSpinner

func StopActiveSpinner()

StopActiveSpinner stops the currently active spinner in the terminal session.

func SuspendActiveSpinner

func SuspendActiveSpinner()

SuspendActiveSpinner temporarily stops the active spinner without deleting its reference, allowing it to be resumed after user interaction.

func WithSpinner

func WithSpinner(message string, fn func() error) error

func WithSpinnerAndDuration

func WithSpinnerAndDuration(message string, fn func() error) error

Types

type FileChange

type FileChange struct {
	Path      string
	Additions int
	Deletions int
}

FileChange represents a modified file with its statistics

type SmartSpinner

type SmartSpinner struct {
	// contains filtered or unexported fields
}

SmartSpinner is a spinner with enhanced capabilities

func NewSmartSpinner

func NewSmartSpinner(initialMessage string) *SmartSpinner

NewSmartSpinner creates a new spinner with an initial message

func (*SmartSpinner) Error

func (s *SmartSpinner) Error(msg string)

func (*SmartSpinner) Log

func (s *SmartSpinner) Log(msg string)

func (*SmartSpinner) Start

func (s *SmartSpinner) Start()

Start starts the spinner and registers it as the globally active spinner.

func (*SmartSpinner) Stop

func (s *SmartSpinner) Stop()

Stop stops the spinner and clears the active spinner record.

func (*SmartSpinner) Success

func (s *SmartSpinner) Success(msg string)

func (*SmartSpinner) UpdateMessage

func (s *SmartSpinner) UpdateMessage(msg string)

func (*SmartSpinner) Warning

func (s *SmartSpinner) Warning(msg string)

type SpinnerBuilder

type SpinnerBuilder struct {
	// contains filtered or unexported fields
}

SpinnerBuilder allows building spinners with flexible configuration

func NewSpinner

func NewSpinner() *SpinnerBuilder

NewSpinner creates a new spinner builder

func (*SpinnerBuilder) Build

func (b *SpinnerBuilder) Build() *SmartSpinner

Build constructs the SmartSpinner with the specified configuration

func (*SpinnerBuilder) WithCharset

func (b *SpinnerBuilder) WithCharset(charset int) *SpinnerBuilder

WithCharset sets the spinner charset

func (*SpinnerBuilder) WithColor

func (b *SpinnerBuilder) WithColor(color string) *SpinnerBuilder

WithColor sets the spinner color

func (*SpinnerBuilder) WithMessage

func (b *SpinnerBuilder) WithMessage(msg string) *SpinnerBuilder

WithMessage sets the spinner message

func (*SpinnerBuilder) WithSpeed

func (b *SpinnerBuilder) WithSpeed(speed time.Duration) *SpinnerBuilder

WithSpeed sets the spinner speed

Jump to

Keyboard shortcuts

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