Documentation ¶
Index ¶
- Constants
- func AddPadding(content string, width int) string
- func ColorF(color, format string, a ...interface{}) string
- func Errorf(format string, a ...interface{}) error
- func FormatRoundedBox(content string) string
- func GetCursorPos() string
- func GetWidth(content string) int
- func ItalicF(format string, a ...interface{}) string
- func PrintBold(msg string)
- func PrintColor(color, msg string)
- func PrintColorAndBg(color, bg, msg string)
- func PrintColorAndBgBold(color, bg, msg string)
- func PrintColorBold(color, msg string)
- func PrintColorUnderline(color, msg string)
- func PrintColorf(color, format string, a ...interface{})
- func PrintDebug(msg string)
- func PrintError(msg string)
- func PrintErrorf(format string, a ...interface{})
- func PrintInfo(msg string)
- func PrintInverse(msg string)
- func PrintItalic(msg string)
- func PrintRoundedBottom(width int)
- func PrintRoundedTop(width int)
- func PrintSuccess(msg string)
- func PrintUnderline(msg string)
- func PrintWarning(msg string)
- func SPrintRoundedBottom(width int) string
- func SPrintRoundedTop(width int) string
- func SetCursorPos(x, y int)
- func TimeToUnixTimestamp(t time.Time) int64
- func TimestampToTime(timestamp string) time.Time
- func UnixMilliTimestamp() int64
- func UnixNanoTimestamp() int64
- func UnixNanoToTime(unixNanoTimestamp int64) time.Time
- func UnixTimeToTime(unixTimestamp int64) time.Time
- func UnixTimestamp() int64
- func UserSessionIdValue(userId uint64, timestamp time.Time) string
Constants ¶
const ( Reset = "\033[0m" // Reset the escape sequence Red = "\033[31m" Green = "\033[32m" Yellow = "\033[33m" Blue = "\033[34m" Purple = "\033[35m" Cyan = "\033[36m" Gray = "\033[37m" White = "\033[97m" )
Ansi colors
const ( Bold = "\033[1m" Underline = "\033[4m" Inverse = "\033[7m" )
Ansi styles
const ( LightRed = "\033[91m" LightGreen = "\033[92m" LightYellow = "\033[93m" LightBlue = "\033[94m" LightPurple = "\033[95m" LightCyan = "\033[96m" )
Ansi 256 light colors
const ( DarkRed = "\033[31m" DarkGreen = "\033[32m" DarkYellow = "\033[33m" DarkBlue = "\033[34m" DarkPurple = "\033[35m" DarkCyan = "\033[36m" )
Ansi 256 dark colors
const ( BgRed = "\033[41m" BgGreen = "\033[42m" BgYellow = "\033[43m" BgBlue = "\033[44m" BgPurple = "\033[45m" BgCyan = "\033[46m" BgGray = "\033[47m" )
Background colors
const ( CursorUp = "\033[A" // Move the cursor up CursorDown = "\033[B" // Move the cursor down CursorRight = "\033[C" // Move the cursor right CursorLeft = "\033[D" // Move the cursor left )
Cursor movement
const ( ClearScreen = "\033[2J" // Clear the screen ClearLine = "\033[K" // Clear the current line Backspace = "\b" // Backspace key Delete = "\033[3~" // Delete key Enter = "\r" // Return carriage Tab = "\t" // Tab // Cursor positioning Home = "\033[H" Position = "\033[%d;%dH" GetPos = "\033[6n" // Save and restore cursor position SaveCursor = "\033[s" RestoreCursor = "\033[u" // Hide and show cursor HideCursor = "\033[?25l" ShowCursor = "\033[?25h" // Overwrite the current line Overwrite = "\033[1A\033[2K" )
Terminal control
const ( RoundedTopLeft = "╭" // Top left corner of a rounded box RoundedTopRight = "╮" // Top right corner of a rounded box RoundedBottomLeft = "╰" // Bottom left corner of a rounded box RoundedBottomRight = "╯" // Bottom right corner of a rounded box RoundedHoriz = "─" // Horizontal line of a rounded box RoundedVert = "│" // Vertical line of a rounded box )
Rounded box characters
Variables ¶
This section is empty.
Functions ¶
func AddPadding ¶
AddPadding adds padding to a string to make it a certain width
func FormatRoundedBox ¶
FormatRoundedBox formats a string into a rounded box with proper padding
func GetCursorPos ¶
func GetCursorPos() string
func PrintColor ¶
func PrintColor(color, msg string)
PrintColor prints a colored message to the console
func PrintColorAndBg ¶
func PrintColorAndBg(color, bg, msg string)
PrintColorAndBg prints a colored message with a background to the console
func PrintColorAndBgBold ¶
func PrintColorAndBgBold(color, bg, msg string)
PrintColorAndBgBold prints a colored bold message with a background to the console
func PrintColorBold ¶
func PrintColorBold(color, msg string)
PrintColorBold prints a colored bold message to the console
func PrintColorUnderline ¶
func PrintColorUnderline(color, msg string)
PrintColorUnderline prints a colored underlined message to the console
func PrintColorf ¶
func PrintColorf(color, format string, a ...interface{})
PrintColorf prints a colored formatted message to the console
func PrintErrorf ¶
func PrintErrorf(format string, a ...interface{})
PrintErrorf prints a formatted error message to the console
func PrintInverse ¶
func PrintInverse(msg string)
PrintInverse prints an inverted message to the console
func PrintRoundedBottom ¶
func PrintRoundedBottom(width int)
PrintRoundedBottom prints a rounded bottom
func PrintSuccess ¶
func PrintSuccess(msg string)
PrintSuccess prints a success message to the console
func PrintUnderline ¶
func PrintUnderline(msg string)
PrintUnderline prints an underlined message to the console
func PrintWarning ¶
func PrintWarning(msg string)
PrintWarning prints a warning message to the console
func SPrintRoundedBottom ¶
SPrintRoundedBottom returns a string with a rounded bottom
func SPrintRoundedTop ¶
SPrintRoundedTop returns a string with a rounded top
func TimeToUnixTimestamp ¶
TimeToUnixTimestamp converts a time.Time object to a Unix timestamp.
func TimestampToTime ¶
func UnixMilliTimestamp ¶
func UnixMilliTimestamp() int64
UnixMilliTimestamp returns the current Unix timestamp in milliseconds.
func UnixNanoTimestamp ¶
func UnixNanoTimestamp() int64
UnixNanoTimestamp returns the current Unix timestamp in nanoseconds.
func UnixNanoToTime ¶
UnixNanoToTime converts a Unix timestamp in nanoseconds to a time.Time object.
func UnixTimeToTime ¶
UnixTimeToTime converts a Unix timestamp to a time.Time object.
func UnixTimestamp ¶
func UnixTimestamp() int64
UnixTimestamp returns the current Unix timestamp in seconds.
Types ¶
This section is empty.