ui

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Red     string = "#FF0000"
	Green   string = "#00FF00"
	Blue    string = "#0000FF"
	Yellow  string = "#FFFF00"
	Orange  string = "#FFA500"
	Purple  string = "#800080"
	Pink    string = "#FFC0CB"
	Brown   string = "#A52A2A"
	Black   string = "#000000"
	White   string = "#FFFFFF"
	Gray    string = "#808080"
	Cyan    string = "#00FFFF"
	Magenta string = "#FF00FF"
)

Variables

This section is empty.

Functions

func CopyToClipboard

func CopyToClipboard(content string) error

CopyToClipboard copies the provided content string to the system clipboard

func GetChoice

func GetChoice(color string, message string, choices []string, defaultChoice string) string

GetChoice prompts the user to choose from multiple options. It displays the available choices in the format "message (choice1/choice2/choice3) [default]: " and validates the input against the provided choices. If an invalid choice is entered, it will prompt again until a valid choice is made. The comparison is case-insensitive. If an empty input is provided, it returns the defaultChoice.

Parameters:

  • color: the color to use for the prompt styling
  • message: the message to display to the user
  • choices: a slice of valid choices the user can select from
  • defaultChoice: the default choice if user presses enter without input

Returns:

  • string: the selected choice from the choices slice

func GetConfirmation

func GetConfirmation(color string, message string, defaultYes bool) bool

GetConfirmation prompts the user for yes/no confirmation with a default value and specified color

func InitMarkdownRenderer

func InitMarkdownRenderer() error

InitMarkdownRenderer initializes the global markdown renderer with terminal-optimized settings

func Input

func Input(color, prompt string) (string, error)

Input creates a colored text input prompt and returns the user's input

func Print

func Print(color string, strs ...any)

Print prints the provided arguments with specified color styling without a newline

func PrintMarkdown

func PrintMarkdown(content string)

PrintMarkdown safely renders and prints markdown content with automatic fallback to plain text

func Printf

func Printf(color string, format string, a ...interface{})

Printf formats and prints text with specified color styling using printf-style formatting

func Println

func Println(color string, strs ...any)

Println prints the provided arguments with specified color styling followed by a newline

func RenderMarkdown

func RenderMarkdown(content string) error

RenderMarkdown converts markdown content to styled terminal output and prints it

Types

type ThinkingController

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

ThinkingController manages the thinking animation

func NewThinkingController

func NewThinkingController() *ThinkingController

NewThinkingController creates a new thinking animation controller with initialized channels

func (*ThinkingController) IsPaused

func (tc *ThinkingController) IsPaused() bool

IsPaused returns true if the thinking animation is currently paused

func (*ThinkingController) IsStarted

func (tc *ThinkingController) IsStarted() bool

IsStarted returns true if the thinking animation is currently running

func (*ThinkingController) Pause

func (tc *ThinkingController) Pause()

Pause pauses the thinking animation if it's currently running

func (*ThinkingController) Resume

func (tc *ThinkingController) Resume()

Resume resumes the thinking animation if it's currently paused

func (*ThinkingController) Start

func (tc *ThinkingController) Start(color string, message string)

Start begins the thinking animation with the specified color and message

func (*ThinkingController) Stop

func (tc *ThinkingController) Stop()

Stop stops the thinking animation, clears the line, and waits for the goroutine to finish

func (*ThinkingController) UpdateMessage

func (tc *ThinkingController) UpdateMessage(message string)

UpdateMessage safely updates the message displayed in the thinking animation

type UserCommand

type UserCommand struct {
	Input      string
	SkipTools  bool
	ShouldExit bool
}

UserCommand represents a parsed user command

func SimplePrompt

func SimplePrompt(promptTitle, placeHolder string) (*UserCommand, error)

SimplePrompt creates an interactive text input prompt and returns a parsed UserCommand

Jump to

Keyboard shortcuts

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