Documentation
¶
Index ¶
- Variables
- func AddStatusFunction(f statusFunction)
- func B2S(s string) []byte
- func Blue(msg string) string
- func Bold(msg string) string
- func CDown()
- func CLeft()
- func CRight()
- func CUp()
- func Check(err error, msg string)
- func Cleanup()
- func ClearEntireLine()
- func ClearFromHereDown()
- func ClearFromHereUp()
- func ClearScreen()
- func ClearToBeginningOfLine()
- func ClearToEndOfLine()
- func Colorize(frmt string, color aec.ANSI, vars ...interface{}) string
- func Cyan(msg string) string
- func FmtPDebug(frmt string, vars ...interface{})
- func GetBoolEnvVar(envName string, defaultValue bool) bool
- func GetCurrentCursorLocation() (int, int)
- func GetEnvVar(envName string, defaultValue string) string
- func GetNumericEnvVar(envName string, defaultValue int) int
- func InitOutputTools()
- func InitTerm()
- func IntPct(progress, total int64) int64
- func MoveCursorDown(times int)
- func MoveCursorLeft(times int)
- func MoveCursorRight(times int)
- func MoveCursorTo(x, y int)
- func MoveCursorUp(times int)
- func NewDurationTimer() *durationTimer
- func Orange(msg string) string
- func PBlue(frmt string, vars ...interface{})
- func PColorize(frmt string, color aec.ANSI, vars ...interface{})
- func PCyan(frmt string, vars ...interface{})
- func PDebug(msg ...string)
- func POrange(frmt string, vars ...interface{})
- func PPink(frmt string, vars ...interface{})
- func PPurple(frmt string, vars ...interface{})
- func PRed(frmt string, vars ...interface{})
- func PWhite(frmt string, vars ...interface{})
- func PYellow(frmt string, vars ...interface{})
- func PanicIfError(err error, msg string)
- func Pink(msg string) string
- func ProgressBar(size, total, done int64) string
- func Purple(msg string) string
- func Red(msg string) string
- func RestorePosition()
- func RestoreTerm()
- func S2B(b []byte) string
- func SPBlue(frmt string, vars ...interface{}) string
- func SPColorize(frmt string, color aec.ANSI, vars ...interface{}) string
- func SPCyan(frmt string, vars ...interface{}) string
- func SPOrange(frmt string, vars ...interface{}) string
- func SPPink(frmt string, vars ...interface{}) string
- func SPPurple(frmt string, vars ...interface{}) string
- func SPRed(frmt string, vars ...interface{}) string
- func SPWhite(frmt string, vars ...interface{}) string
- func SPYellow(frmt string, vars ...interface{}) string
- func SavePosition()
- func ScreenHeight() int
- func ScreenSize() (x, y int)
- func ScreenWidth() int
- func TPClearScreen() string
- func TPClearToEndOfScreen() string
- func TPClearToTopOfScreen() string
- func TPCols() int
- func TPCursorDown(times int) string
- func TPCursorLeft(times int) string
- func TPCursorPosition(x, y int) string
- func TPCursorRight(times int) string
- func TPCursorUp(times int) string
- func TPDeviceStatusReport() string
- func TPEraseLine() string
- func TPEraseLineBackward() string
- func TPEraseLineForward() string
- func TPRestoreCursor() string
- func TPRows() int
- func TPSaveCursor() string
- func TPTermSize() (width, height int)
- func TermCheck(err error, msg string)
- func ToggleDebugIfNeeded(flag bool)
- func UpdateCursorLocation() error
- func UpdateStatus()
- func White(msg string) string
- func Yellow(msg string) string
Constants ¶
This section is empty.
Variables ¶
var ( TERM_INITED bool = false // Only want to do init once XPos, YPos int // X and Y position of the cursor as reported by 'UpdateCursorLocation' )
var ( DEBUG bool // Enable PDebug output StatusFunctions []statusFunction // List of functions that should be called by `UpdateStatus` )
var ( Start time.Time // When we want to start our timer End time.Time // Track if we togged debug output or not in ToggleDebugIfNeeded() )
Ideally this would be a map or array so we could have multiple timers. TODO: Do that thing mentioned in the previous line
Functions ¶
func AddStatusFunction ¶
func AddStatusFunction(f statusFunction)
func Cleanup ¶
func Cleanup()
Things we want to make sure we run on exit. Ideally, whoever calls us will put a `defer stdgomods.Cleanup()` very early in their `main()` function.
func ClearEntireLine ¶
func ClearEntireLine()
func ClearFromHereDown ¶
func ClearFromHereDown()
func ClearFromHereUp ¶
func ClearFromHereUp()
func ClearScreen ¶
func ClearScreen()
func ClearToBeginningOfLine ¶
func ClearToBeginningOfLine()
func ClearToEndOfLine ¶
func ClearToEndOfLine()
func GetBoolEnvVar ¶
Sometimes we want to use boolean ENV variables.
func GetNumericEnvVar ¶
Sometimes we want to use numeric ENV variables.
func InitOutputTools ¶
func InitOutputTools()
func MoveCursorDown ¶
func MoveCursorDown(times int)
func MoveCursorLeft ¶
func MoveCursorLeft(times int)
func MoveCursorRight ¶
func MoveCursorRight(times int)
func MoveCursorTo ¶
func MoveCursorTo(x, y int)
func MoveCursorUp ¶
func MoveCursorUp(times int)
func NewDurationTimer ¶
func NewDurationTimer() *durationTimer
func PDebug ¶
func PDebug(msg ...string)
Print debug info. Uses logger with one-time config options set in InitOutputTools() It will only print if the global DEBUG variable is 'true'
func PanicIfError ¶
Simple utility function to check the error status and, if it is not nil, log.Panic a message and exit
func ProgressBar ¶
This returns a string for a progress bar that looks like so:
[###########=====]
Colorization might be a thing... we'll see Params:
- size: Number of discrete units in the bar
- total: Total items to be done
- done: Number of items that ARE done
func RestorePosition ¶
func RestorePosition()
func RestoreTerm ¶
func RestoreTerm()
func SavePosition ¶
func SavePosition()
func ScreenHeight ¶
func ScreenHeight() int
func ScreenSize ¶
func ScreenSize() (x, y int)
func ScreenWidth ¶
func ScreenWidth() int
func TPClearScreen ¶
func TPClearScreen() string
func TPClearToEndOfScreen ¶
func TPClearToEndOfScreen() string
func TPClearToTopOfScreen ¶
func TPClearToTopOfScreen() string
func TPCursorDown ¶
func TPCursorLeft ¶
func TPCursorPosition ¶
func TPCursorRight ¶
func TPCursorUp ¶
func TPDeviceStatusReport ¶
func TPDeviceStatusReport() string
func TPEraseLine ¶
func TPEraseLine() string
func TPEraseLineBackward ¶
func TPEraseLineBackward() string
func TPEraseLineForward ¶
func TPEraseLineForward() string
func TPRestoreCursor ¶
func TPRestoreCursor() string
func TPSaveCursor ¶
func TPSaveCursor() string
func TPTermSize ¶
func TPTermSize() (width, height int)
func TermCheck ¶
Works around race condition when using 'Check' from inside InitTerm (but after we start mucking with the terminal window)
func ToggleDebugIfNeeded ¶
func ToggleDebugIfNeeded(flag bool)
This is used to allow for fine-grained DEBUG output with multiple flags. Caveats: - Do not overlap areas that flags are used. The intent is for flags to be specific to a function - This is intended used in conjunction with PDebug().
func UpdateCursorLocation ¶
func UpdateCursorLocation() error
// Currently busted because I don't have a reliable way to get the results back // from TPDeviceStatusReport(). *IF* I get those results back, it works great. // TODO: Get reliable way to read buffer
func UpdateStatus ¶
func UpdateStatus()
Use our cursor movement abilities to make a small status section in the upper right corner to print out whatever we thing is important up there.
Types ¶
This section is empty.