Documentation ¶
Index ¶
- func Body(m string) string
- func Indent(m string) string
- type BodyWriter
- type ErrorWriter
- type FormatWriter
- type TitleWriter
- type WarnWriter
- type Writer
- func (w *Writer) Body(text string)
- func (w *Writer) Bodyf(text string, a ...interface{})
- func (w *Writer) BufferWriter() *bufio.Writer
- func (w *Writer) Confirm(question string) (bool, error)
- func (w *Writer) Error(m string)
- func (w *Writer) ErrorHeader(text string)
- func (w *Writer) Errorf(m string, f ...interface{})
- func (w *Writer) Errorln(m string)
- func (w *Writer) Fail(m string)
- func (w *Writer) FailCause(e error)
- func (w *Writer) FailError(e error)
- func (w *Writer) FailWrap(e error, m string)
- func (w *Writer) FailWrapCause(e error, m string)
- func (w *Writer) Failf(m string, f ...interface{})
- func (w *Writer) Failt(errType string, m string)
- func (w *Writer) Failtf(errType string, m string, f ...interface{})
- func (w *Writer) HR()
- func (w *Writer) LongWarningln(m string)
- func (w *Writer) NewSpinner() *spinner.Spinner
- func (w *Writer) NewSpinnerWithTab() *spinner.Spinner
- func (w *Writer) Print(m string)
- func (w *Writer) Printf(m string, f ...interface{})
- func (w *Writer) Println(m string)
- func (w *Writer) Prompt(promptText string) (response string, err error)
- func (w *Writer) Skipped(m string)
- func (w *Writer) Skippedf(m string, f ...interface{})
- func (w *Writer) StartSpinner()
- func (w *Writer) StopSpinner()
- func (w *Writer) Success(m string)
- func (w *Writer) Successf(m string, f ...interface{})
- func (w *Writer) Title(text string)
- func (w *Writer) Titlef(text string, a ...interface{})
- func (w *Writer) Warn(m string)
- func (w *Writer) WarnError(e error)
- func (w *Writer) Warnf(m string, f ...interface{})
- func (w *Writer) Warnln(m string)
- func (w *Writer) Write(p []byte) (int, error)
- func (w *Writer) Writer() io.Writer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BodyWriter ¶
BodyWriter is an interface for printers that can print indented sub-steps of a process.
type ErrorWriter ¶
ErrorWriter is an interface for printers that print to a writer that the user expects errors on, such as stderr.
type FormatWriter ¶
type FormatWriter interface { // Writers Print(string) Printf(string, ...interface{}) Println(string) Success(string) Successf(string, ...interface{}) Skipped(string) Skippedf(string, ...interface{}) Fail(string) Failf(string, ...interface{}) FailError(error) FailWrap(error, string) FailCause(error) FailWrapCause(error, string) Failt(string, string) Failtf(string, string, ...interface{}) BodyWriter TitleWriter ErrorWriter WarnWriter HR() ErrorHeader(string) Confirm(string) (bool, error) Prompt(string) (string, error) // Implement a buffered version of the io.Writer interface Writer() io.Writer BufferWriter() *bufio.Writer // Spinner StartSpinner() StopSpinner() }
FormatWriter is a writer interface that includes formatting helpers
type TitleWriter ¶
TitleWriter is an interface for printers that can print indented sub-steps of a process.
type WarnWriter ¶
type WarnWriter interface { Warn(string) Warnf(string, ...interface{}) Warnln(string) WarnError(error) LongWarningln(string) }
WarnWriter is an interface for printers that can printed warnings
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer is the default implementation of of the cli FormatWriter interface
func (*Writer) BufferWriter ¶
BufferWriter returns a pointer to the cli.Writer's bufio.Writer
func (*Writer) Confirm ¶
Confirm asks the user if they want to take the action defined in the question or not. Ex: Confirm("should we do the thing?") > should we do the thing? (y/n) <waits for stdin>
func (*Writer) ErrorHeader ¶
ErrorHeader prints an ASCII horizontal rule, then "ERROR: " plus your text and then another hr, like this: ErrorHeader("didn't catch 'em all :'(") -------------------------------------------------------------------------------- ERROR: didn't catch 'em all :'( --------------------------------------------------------------------------------
func (*Writer) Errorf ¶
Errorf formats the message with the format string and writes it to the error writer.
func (*Writer) FailCause ¶
FailCause prints the error's message and attempts to locate a root cause. In the event a root cause is found that is not the error it will also print the cause.
func (*Writer) FailError ¶
FailError formats the error's message as a Failure message and writes it to the writer.
func (*Writer) FailWrap ¶
FailWrap wraps the error's message and outputs it to the writer as a Failure message.
func (*Writer) FailWrapCause ¶
FailWrapCause wraps the error's message and prints the error message. In the event a root cause is found that is not the error it will also print the cause.
func (*Writer) Failf ¶
Failf formats the message with the format string and writes it to the writer as a Failure message.
func (*Writer) Failtf ¶
Failtf prints the error message with an error type header and with a formatted message
func (*Writer) LongWarningln ¶
LongWarningln colors the output as a warning but does not append any text
func (*Writer) NewSpinner ¶
func (*Writer) NewSpinnerWithTab ¶
func (*Writer) Printf ¶
Printf formats the message with the format string and writes it to the writer.
func (*Writer) Skipped ¶
Skipped formats the message to a Skipped message and writes it to the writer.
func (*Writer) Skippedf ¶
Skippedf formats the message using the format string and writes it to the writer as a Skipped message.
func (*Writer) Success ¶
Success formats the message to a Success message and writes it to the writer.
func (*Writer) Successf ¶
Successf formats the message using the format string and writes it to the writer as a Success message.
func (*Writer) WarnError ¶
WarnError formats the error's message as a Warning message and writes it to the writer.
func (*Writer) Warnf ¶
Warnf formats the message with the format string and writes it to the writer as a Warning message.
func (*Writer) Warnln ¶
Warnln formats the messages as a warning and writes it to the writer, appending a newline.