Documentation ¶
Index ¶
- Constants
- func Bold(a string) string
- func Causef(format string, a ...interface{}) string
- func Hintf(format string, a ...interface{}) string
- func Log(err error)
- func LogDebug(header string, lines ...string)
- func LogInfo(header string, lines ...string)
- func LogSuccess(header string, lines ...string)
- func LogWarn(header string, lines ...string)
- func SetOutput(w io.Writer)
- func Tipf(format string, a ...interface{}) string
- type CLIError
- type CLIMessage
Constants ¶
const BlankLine = ""
BlankLine is an empty string meant to be used in CLIMessage and CLIError construction.
Variables ¶
This section is empty.
Functions ¶
func Causef ¶
Causef formats according to the given format specifier and prepends a bolded "cause: " header.
func Hintf ¶
Hintf formats according to the given format specifier and prepends a bolded "hint: " header.
func Log ¶
func Log(err error)
Log logs the given error to stderr, defaulting to "fatal" if the error is not a CLIError. If the error is a CLIError, the plain error chain is ignored and the CLIError is logged on its own.
func LogDebug ¶
LogDebug prints the given debug message to stderr if and only if the env var `DEBUG` is nonempty.
func LogSuccess ¶
LogSuccess prints the given info message to stderr.
Types ¶
type CLIError ¶
type CLIError struct { CLIMessage // contains filtered or unexported fields }
CLIError wraps a CLIMessage and allows consumers to treat it as a normal error.
type CLIMessage ¶
CLIMessage provides a human-readable message for CLI errors and messages.
func (CLIMessage) String ¶
func (m CLIMessage) String() string
String formats the CLI message for consumption by a human.