Documentation
¶
Overview ¶
Package utils provides utility functions for INIQ
Index ¶
- Constants
- func BackupFile(filePath string, backupEnabled bool) (string, error)
- func BoldText(text string) string
- func ColorText(text string, colorCode string) string
- func ErrorText(text string) string
- func InfoText(text string) string
- func IsTerminal(f *os.File) bool
- func PromptWithDefault(question string, defaultValue string) string
- func PromptYesNo(question string, defaultValue bool) bool
- func SuccessText(text string) string
- func WarningText(text string) string
Constants ¶
const ( // Basic colors ColorReset = "\033[0m" ColorGray = "\033[90m" ColorGreen = "\033[32m" ColorYellow = "\033[33m" ColorBlue = "\033[34m" ColorRed = "\033[31m" ColorCyan = "\033[36m" ColorMagenta = "\033[35m" // Bright colors ColorBrightGreen = "\033[92m" ColorBrightYellow = "\033[93m" ColorBrightBlue = "\033[94m" ColorBrightRed = "\033[91m" ColorBrightCyan = "\033[96m" // Text styles ColorBold = "\033[1m" ColorUnderline = "\033[4m" // Combined styles ColorHeaderBlue = "\033[1;34m" // Bold Blue ColorHeaderCyan = "\033[1;36m" // Bold Cyan ColorSuccess = "\033[32m" // Green ColorWarning = "\033[33m" // Yellow ColorError = "\033[31m" // Red ColorInfo = "\033[34m" // Blue ColorDebug = "\033[36m" // Cyan ColorListItem = "\033[90m" // Gray )
Colors for terminal output
Variables ¶
This section is empty.
Functions ¶
func BackupFile ¶
BackupFile creates a backup of a file with a timestamp If the file doesn't exist, it returns nil without creating a backup Returns the path to the backup file if successful
func IsTerminal ¶
IsTerminal checks if the given file is a terminal
func PromptWithDefault ¶
PromptWithDefault asks the user for input with a default value and returns the user's input or the default if the user just presses Enter.
func PromptYesNo ¶
PromptYesNo asks the user a yes/no question and returns true for yes, false for no. The defaultValue parameter determines the default answer if the user just presses Enter. After the user makes a choice, it displays what was selected.
func SuccessText ¶
SuccessText returns the text in success color (green)
func WarningText ¶
WarningText returns the text in warning color (yellow)
Types ¶
This section is empty.