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.
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 ¶
- Constants
- Variables
- func ColorWrap(str string, attr color.Attribute) string
- func Command(format string, a ...any)
- func Debug(payload ...any)
- func Debugf(format string, a ...any)
- func DisableColor()
- func GetLogo() string
- func HeaderInfof(format string, a ...any)
- func HorizontalRule()
- func Info(message string)
- func Infof(format string, a ...any)
- func InitializePTerm(w io.Writer)
- 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 PrintComponentCredential(state *types.ZarfState, componentName string)
- func PrintConnectStringTable(connectStrings types.ConnectStrings)
- func PrintCredentialTable(state *types.ZarfState, componentsToDeploy []types.DeployedComponent)
- func PrintCredentialUpdates(oldState *types.ZarfState, newState *types.ZarfState, services []string)
- func Question(text string)
- func Questionf(format string, a ...any)
- func SetLogLevel(lvl LogLevel)
- func Success(message string)
- func Successf(format string, a ...any)
- func Table(header []string, data [][]string)
- func Title(title string, help string)
- func Warn(message string)
- func WarnErr(err any, message string)
- func WarnErrf(err any, format string, a ...any)
- func Warnf(format string, a ...any)
- func ZarfCommand(format string, a ...any)
- type DebugWriter
- type LogLevel
- type PausableWriter
- type ProgressBar
- func (p *ProgressBar) Add(n int)
- func (p *ProgressBar) Close() error
- func (p *ProgressBar) Failf(format string, a ...any)
- func (p *ProgressBar) GetCurrent() int
- func (p *ProgressBar) Successf(format string, a ...any)
- func (p *ProgressBar) Update(complete int64, text string)
- func (p *ProgressBar) Updatef(format string, a ...any)
- 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) Stop()
- func (p *Spinner) Success()
- func (p *Spinner) Successf(format string, a ...any)
- func (p *Spinner) Updatef(format string, a ...any)
- func (p *Spinner) Write(raw []byte) (int, error)
- type ZarfHandler
Constants ¶
const ( RegistryKey = "registry" RegistryReadKey = "registry-readonly" GitKey = "git" GitReadKey = "git-readonly" ArtifactKey = "artifact" AgentKey = "agent" )
Common constants for printing credentials
Variables ¶
var NoProgress bool
NoProgress tracks whether spinner/progress bars show updates.
var RuleLine = strings.Repeat("━", TermWidth)
RuleLine creates a line of ━ as wide as the terminal
Functions ¶
func ColorWrap ¶ added in v0.32.0
ColorWrap changes a string to an ansi color code and appends the default color to the end preventing future characters from taking on the given color returns string as normal if color is disabled
func HeaderInfof ¶
HeaderInfof prints a large header with a formatted message.
func HorizontalRule ¶ added in v0.26.0
func HorizontalRule()
HorizontalRule prints a white horizontal rule to separate the terminal
func InitializePTerm ¶ added in v0.35.0
InitializePTerm sets the default styles and output for pterm.
func Paragraphn ¶ added in v0.26.0
Paragraphn formats text into an n column paragraph
func PrintComponentCredential ¶ added in v0.29.0
PrintComponentCredential displays credentials for a single component
func PrintConnectStringTable ¶
func PrintConnectStringTable(connectStrings types.ConnectStrings)
PrintConnectStringTable prints a table of connect strings.
func PrintCredentialTable ¶ added in v0.29.0
func PrintCredentialTable(state *types.ZarfState, componentsToDeploy []types.DeployedComponent)
PrintCredentialTable displays credentials in a table
func PrintCredentialUpdates ¶ added in v0.29.0
func PrintCredentialUpdates(oldState *types.ZarfState, newState *types.ZarfState, services []string)
PrintCredentialUpdates displays credentials that will be updated
func Questionf ¶ added in v0.26.0
Questionf prints a user prompt description message with a given format.
func Title ¶ added in v0.27.1
Title prints a title and an optional help description for that section
func ZarfCommand ¶ added in v0.28.0
ZarfCommand prints a zarf terminal command.
Types ¶
type DebugWriter ¶ added in v0.26.0
type DebugWriter struct{}
DebugWriter represents a writer interface that writes to message.Debug
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 // TermWidth sets the width of full width elements like progressbars and headers TermWidth = 100 )
type PausableWriter ¶ added in v0.34.0
type PausableWriter struct {
// contains filtered or unexported fields
}
PausableWriter is a pausable writer
func NewPausableWriter ¶ added in v0.34.0
func NewPausableWriter(wr io.Writer) *PausableWriter
NewPausableWriter creates a new pausable writer
func UseLogFile ¶
func UseLogFile(f *os.File) (*PausableWriter, error)
UseLogFile wraps a given file in a PausableWriter and sets it as the log file used by the message package.
func (*PausableWriter) Pause ¶ added in v0.34.0
func (pw *PausableWriter) Pause()
Pause sets the output writer to io.Discard
func (*PausableWriter) Resume ¶ added in v0.34.0
func (pw *PausableWriter) Resume()
Resume sets the output writer back to the original writer
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) Close ¶ added in v0.35.0
func (p *ProgressBar) Close() error
Close stops the ProgressBar from continuing.
func (*ProgressBar) Failf ¶ added in v0.35.0
func (p *ProgressBar) Failf(format string, a ...any)
Failf marks the ProgressBar as failed in the CLI.
func (*ProgressBar) GetCurrent ¶ added in v0.32.3
func (p *ProgressBar) GetCurrent() int
GetCurrent returns the current total
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) Updatef ¶ added in v0.35.0
func (p *ProgressBar) Updatef(format string, a ...any)
Updatef 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.
type ZarfHandler ¶ added in v0.32.5
type ZarfHandler struct{}
ZarfHandler is a simple handler that implements the slog.Handler interface
func (ZarfHandler) Enabled ¶ added in v0.32.5
Enabled is always set to true as zarf logging functions are already aware of if they are allowed to be called
func (ZarfHandler) Handle ¶ added in v0.32.5
Handle prints the respective logging function in zarf This function ignores any key pairs passed through the record