Documentation
¶
Index ¶
- Constants
- func CopyToClipboard(content string) error
- func GetChoice(color string, message string, choices []string, defaultChoice string) string
- func GetConfirmation(color string, message string, defaultYes bool) bool
- func InitMarkdownRenderer() error
- func Input(color, prompt string) (string, error)
- func Print(color string, strs ...any)
- func PrintMarkdown(content string)
- func Printf(color string, format string, a ...interface{})
- func Println(color string, strs ...any)
- func RenderMarkdown(content string) error
- type ThinkingController
- func (tc *ThinkingController) IsPaused() bool
- func (tc *ThinkingController) IsStarted() bool
- func (tc *ThinkingController) Pause()
- func (tc *ThinkingController) Resume()
- func (tc *ThinkingController) Start(color string, message string)
- func (tc *ThinkingController) Stop()
- func (tc *ThinkingController) UpdateMessage(message string)
- type UserCommand
Constants ¶
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 ¶
CopyToClipboard copies the provided content string to the system clipboard
func GetChoice ¶
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 ¶
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 PrintMarkdown ¶
func PrintMarkdown(content string)
PrintMarkdown safely renders and prints markdown content with automatic fallback to plain text
func Printf ¶
Printf formats and prints text with specified color styling using printf-style formatting
func Println ¶
Println prints the provided arguments with specified color styling followed by a newline
func RenderMarkdown ¶
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 ¶
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