# README
Hobocode
Hobocode is a pty-aware colorized printing library intended for use in CLI applications for human consumption and UX rather than structured outputs.
Uses go-pretty v6 for colors and Sprinting.
hobocode.Header("Hobocode Example")
hobocode.Success("Welcome to hobocode")
The underlying functions can be used if you are working with custom *os.File's or you can use the lazy opinionated helpers like
Plain
hobocode.Warn("Something might be going wrong")
Formatted
hobocode.Debugf("Output: %v", ret.Body())
Indented
hobocode.Ierror(2, "Something went terribly wrong")
Indented and Formatted
hobocode.Iinfof(1, "Date: %s", time.Now().Format("2006/01/02"))
Example
See examples
import (
"github.com/asciifaceman/hobocode"
)
func main() {
userinput := hobocode.Input("nvim", "What is your preferred editor?")
hobocode.Notef("You chose: %s", userinput)
}
# Packages
No description provided by the author
# Functions
Colorable reports if the given *os.File is a terminal or not (os.Stdout, os.Stderr).
Confirm is a naive confirmation prompt in HiRed that won't break until an explicit answer is given.
Confirmf is a naive confirmation prompt in HiRed that won't break until an affirmative answer is given (with a formatted message).
Debug prints the given message with bright green if Colorable
Stdout.
Debugf prints the given formatted message with bright green if Colorable
Stdout.
Error prints the given message with bright red if Colorable
Stderr.
Errorf prints the given formatted message with bright red if Colorable
Stderr.
Ficolor prints the given string at the given indent to the given os.File with the given text.Color, if colorable and does not newline.
Ficolorf prints the given format at the given indent to the given os.File with the given text.Color, if colorable and does not newline.
Header prints a header title wrapped by "=" characters sized to the terminal width
Stdout.
HeaderLeft prints a header title offset to the left wrapped by "=" characters sized to the terminal width
Stdout.
Icolor prints the given string at the given indent to the given os.File with the given text.Color, if colorable with newline.
Icolorf prints the given format at the given indent to the given os.File with the given text.Color, if colorable with newline.
Idebug prints the given message with bright green if Colorable with an indent
Stdout.
Idebugf prints the given formatted message with bright green if Colorable with an indent
Stdout.
Ierror prints the given message with bright red if Colorable and an indent
Stderr.
Ierrorf prints the given formatted message with bright red if Colorable and an indent
Stderr.
Iinfo prints the given message with bright cyan if Colorable and an indent
Stdout.
Iinfof prints the given formatted message with bright cyan if Colorable and an indent
Stdout.
Info prints the given message with bright cyan if Colorable
Stdout.
Infof prints the given formatted message with bright cyan if colorable
Stdout.
Input acquires user CLI input.
Inputd acquires user CLI input with a default defaultOption is presented as the default and used on nil entry.
Inputf acquires user CLI input using a formatted message defaultOption is presented as the default and used on nil entry.
Isuccess prints the given message with bright green if Colorable with an indent
Stdout.
Isuccessf prints the given formatted message with bright green if Colorable with an indent
Stdout.
Iwarn prints the given message with bright yellow if Colorable and an indent
Stderr.
Iwarnf prints the given formatted message with bright yellow if Colorable and an indent
Stderr.
Select allows the user to select from a list of options the index of the options is used as the selection and the user selection is returned as that int a response of -1 indicates a failure to capture input message introduces the list selection prompt is the input line.
Selectr allows the user to select from a list of options with a recommended option the index of the options is used as the selection and the user selection is returned as that int a response of -1 indicates a failure to capture input message introduces the list selection prompt is the input line.
Size returns the terminal size or error.
Std prints without newline to *os.FIle.
Stderr prints without newline to os.Stdout.
Stderrln prints with newline to os.Stderr.
Stdlin prints with newline to *os.File the given message.
Stdout prints without newline to os.Stdout.
Stdoutln prints with newline to os.Stdout.
Success prints the given message with bright green if Colorable
Stdout.
Successf prints the given formatted message with bright green if Colorable
Stdout.
Tindent returns a tabbed indent repeated n times.
Warn prints the given message with bright yellow if Colorable
Stderr.
Warnf prints the given formatted message with bright yellow if Colorable
Stderr.