Documentation ¶
Overview ¶
Package message provides a rich set of functions for displaying messages to the user.
Package message provides a rich set of functions for displaying messages to the user.
Package message provides a rich set of functions for displaying messages to the user.
Package message provides a rich set of functions for displaying messages to the user.
Package message provides a rich set of functions for displaying messages to the user.
Package message provides a rich set of functions for displaying messages to the user.
Index ¶
- Variables
- func Debug(payload ...any)
- func Debugf(format string, a ...any)
- func Error(err any, message string)
- func ErrorWebf(err any, w http.ResponseWriter, format string, a ...any)
- func Errorf(err any, format string, a ...any)
- func Fatal(err any, message string)
- func Fatalf(err any, format string, a ...any)
- func GetLogo() string
- func HeaderInfof(format string, a ...any)
- func HorizontalNoteRule()
- func HorizontalRule()
- func Info(message string)
- func Infof(format string, a ...any)
- func JSONValue(value any) string
- func Note(text string)
- func Notef(format string, a ...any)
- func Paragraph(format string, a ...any) string
- func Paragraphn(n int, format string, a ...any) string
- func PrintConnectStringTable(connectStrings types.ConnectStrings)
- func Question(text string)
- func Questionf(format string, a ...any)
- func SetLogLevel(lvl LogLevel)
- func Successf(format string, a ...any)
- func UseLogFile()
- func Warn(message string)
- func Warnf(format string, a ...any)
- type DebugWriter
- type Generic
- type LogLevel
- type ProgressBar
- func (p *ProgressBar) Add(n int)
- func (p *ProgressBar) Fatalf(err error, format string, a ...any)
- func (p *ProgressBar) Stop()
- func (p *ProgressBar) Successf(format string, a ...any)
- func (p *ProgressBar) Update(complete int64, text string)
- func (p *ProgressBar) UpdateTitle(text string)
- func (p *ProgressBar) Write(data []byte) (int, error)
- type Spinner
- func (p *Spinner) DisablePreserveWrites()
- func (p *Spinner) EnablePreserveWrites()
- func (p *Spinner) Errorf(err error, format string, a ...any)
- func (p *Spinner) Fatal(err error)
- func (p *Spinner) Fatalf(err error, format string, a ...any)
- func (p *Spinner) Stop()
- func (p *Spinner) Success()
- func (p *Spinner) Successf(format string, a ...any)
- func (p *Spinner) Updatef(format string, a ...any)
- func (p *Spinner) Warnf(format string, a ...any)
- func (p *Spinner) Write(raw []byte) (int, error)
Constants ¶
This section is empty.
Variables ¶
var NoProgress bool
NoProgress tracks whether spinner/progress bars show updates.
Functions ¶
func ErrorWebf ¶
func ErrorWebf(err any, w http.ResponseWriter, format string, a ...any)
ErrorWebf prints an error message and returns a web response.
func HeaderInfof ¶
HeaderInfof prints a large header with a formatted message.
func HorizontalNoteRule ¶ added in v0.26.0
func HorizontalNoteRule()
HorizontalNoteRule prints a yellow horizontal rule to separate the terminal
func HorizontalRule ¶ added in v0.26.0
func HorizontalRule()
HorizontalRule prints a white horizontal rule to separate the terminal
func Paragraphn ¶ added in v0.26.0
Paragraphn formats text into an n column paragraph
func PrintConnectStringTable ¶
func PrintConnectStringTable(connectStrings types.ConnectStrings)
PrintConnectStringTable prints a table of connect strings.
func Question ¶
func Question(text string)
Question prints a formatted message used in conjunction with a user prompt.
func Questionf ¶ added in v0.26.0
Questionf prints a formatted message used in conjunction with a user prompt.
Types ¶
type DebugWriter ¶ added in v0.26.0
type DebugWriter struct{}
DebugWriter represents a writer interface that writes to message.Debug
type Generic ¶
type Generic struct{}
Generic is used to implement the io.Writer interface for generic messages.
type LogLevel ¶
type LogLevel int
LogLevel is the level of logging to display.
const ( // WarnLevel level. Non-critical entries that deserve eyes. WarnLevel LogLevel = iota // InfoLevel level. General operational entries about what's going on inside the // application. InfoLevel // DebugLevel level. Usually only enabled when debugging. Very verbose logging. DebugLevel // TraceLevel level. Designates finer-grained informational events than the Debug. TraceLevel )
type ProgressBar ¶
type ProgressBar struct {
// contains filtered or unexported fields
}
ProgressBar is a struct used to drive a pterm ProgressbarPrinter.
func NewProgressBar ¶
func NewProgressBar(total int64, text string) *ProgressBar
NewProgressBar creates a new ProgressBar instance from a total value and a format.
func (*ProgressBar) Add ¶ added in v0.25.0
func (p *ProgressBar) Add(n int)
Add updates the ProgressBar with completed progress.
func (*ProgressBar) Fatalf ¶
func (p *ProgressBar) Fatalf(err error, format string, a ...any)
Fatalf marks the ProgressBar as failed in the CLI.
func (*ProgressBar) Successf ¶ added in v0.24.3
func (p *ProgressBar) Successf(format string, a ...any)
Successf marks the ProgressBar as successful in the CLI.
func (*ProgressBar) Update ¶
func (p *ProgressBar) Update(complete int64, text string)
Update updates the ProgressBar with completed progress and new text.
func (*ProgressBar) UpdateTitle ¶ added in v0.26.0
func (p *ProgressBar) UpdateTitle(text string)
UpdateTitle updates the ProgressBar with new text.
type Spinner ¶
type Spinner struct {
// contains filtered or unexported fields
}
Spinner is a wrapper around pterm.SpinnerPrinter.
func NewProgressSpinner ¶
NewProgressSpinner creates a new progress spinner.
func (*Spinner) DisablePreserveWrites ¶ added in v0.24.0
func (p *Spinner) DisablePreserveWrites()
DisablePreserveWrites disables preserving writes to the terminal.
func (*Spinner) EnablePreserveWrites ¶ added in v0.24.0
func (p *Spinner) EnablePreserveWrites()
EnablePreserveWrites enables preserving writes to the terminal.
func (*Spinner) Success ¶
func (p *Spinner) Success()
Success prints a success message and stops the spinner.