Documentation
¶
Index ¶
- Constants
- Variables
- func Blue(text string) string
- func Bold(text string) string
- func Colorize(color, text string) string
- func Confirm(question string) (bool, error)
- func ConfirmWithDefault(question string, defaultValue bool) (bool, error)
- func CopyDir(src, dst string) error
- func CreateDir(path string) error
- func CreateFile(path, content string) error
- func Cyan(text string) string
- func DirExists(path string) bool
- func Error(msg string)
- func FileExists(path string) bool
- func GetProjectRoot() (string, error)
- func Gray(text string) string
- func Green(text string) string
- func Info(msg string)
- func IsForgeUIProject(dir string) bool
- func IsGoProject(dir string) bool
- func Prompt(question string) (string, error)
- func PromptWithDefault(question, defaultValue string) (string, error)
- func Purple(text string) string
- func ReadLine() (string, error)
- func Red(text string) string
- func Select(question string, options []string) (int, error)
- func SelectWithDefault(question string, options []string, defaultIndex int) (int, error)
- func Spin(message string, fn func() error) error
- func SpinWithMessage(message, successMsg string, fn func() error) error
- func Success(msg string)
- func ToCamelCase(s string) string
- func ToPascalCase(s string) string
- func ToSnakeCase(s string) string
- func ValidateGoModule(module string) error
- func ValidateProjectName(name string) error
- func Warning(msg string)
- func Yellow(text string) string
- type PromptReader
- type Spinner
- func (s *Spinner) Error(msg string)
- func (s *Spinner) Start()
- func (s *Spinner) Stop()
- func (s *Spinner) Success(msg string)
- func (s *Spinner) UpdateMessage(msg string)
- func (s *Spinner) WithDelay(delay time.Duration) *Spinner
- func (s *Spinner) WithFrames(frames []string) *Spinner
- func (s *Spinner) WithWriter(w io.Writer) *Spinner
Constants ¶
const ( ColorReset = "\033[0m" ColorRed = "\033[31m" ColorGreen = "\033[32m" ColorYellow = "\033[33m" ColorBlue = "\033[34m" ColorPurple = "\033[35m" ColorCyan = "\033[36m" ColorWhite = "\033[37m" ColorGray = "\033[90m" ColorBold = "\033[1m" ColorBoldRed = "\033[1;31m" ColorBoldGreen = "\033[1;32m" ColorBoldYellow = "\033[1;33m" ColorBoldBlue = "\033[1;34m" ColorBoldPurple = "\033[1;35m" ColorBoldCyan = "\033[1;36m" ColorBoldWhite = "\033[1;37m" )
ANSI color codes
Variables ¶
var ( // NoColor disables color output NoColor = os.Getenv("NO_COLOR") != "" )
Functions ¶
func ConfirmWithDefault ¶
ConfirmWithDefault prompts the user for yes/no with a default
func CreateFile ¶
CreateFile creates a file with content
func GetProjectRoot ¶
GetProjectRoot finds the project root by looking for go.mod
func IsForgeUIProject ¶
IsForgeUIProject checks if the directory is a ForgeUI project
func IsGoProject ¶
IsGoProject checks if the directory is a Go project
func PromptWithDefault ¶
PromptWithDefault prompts the user for input with a default value
func SelectWithDefault ¶
SelectWithDefault prompts the user to select from a list with a default
func SpinWithMessage ¶
SpinWithMessage runs a function with a spinner and custom success message
func ValidateGoModule ¶
ValidateGoModule validates a Go module path
func ValidateProjectName ¶
ValidateProjectName validates a project name
Types ¶
type PromptReader ¶
PromptReader is an interface for reading user input (for testing)
type Spinner ¶
type Spinner struct {
// contains filtered or unexported fields
}
Spinner provides a simple loading spinner
func NewSpinner ¶
NewSpinner creates a new spinner with a message
func (*Spinner) UpdateMessage ¶
UpdateMessage updates the spinner message
func (*Spinner) WithFrames ¶
WithFrames sets custom spinner frames