Documentation ¶
Index ¶
- Constants
- type Level
- type Printer
- func (p *Printer) Debug(level Level, msg string, args ...any)
- func (p *Printer) Error(msg string, args ...any)
- func (p *Printer) Info(msg string, args ...any)
- func (p *Printer) Outputf(msg string, args ...any)
- func (p *Printer) Outputln(msg string)
- func (p *Printer) PagerDisplay(content string) error
- func (p *Printer) PromptForConfirmation(prompt string) error
- func (p *Printer) PromptForEnter(prompt string) error
- func (p *Printer) Warn(msg string, args ...any)
Constants ¶
const ( DebugLevel Level = "debug" InfoLevel Level = "info" WarningLevel Level = "warning" ErrorLevel Level = "error" JSONOutputFormat = "json" PrettyOutputFormat = "pretty" NoneOutputFormat = "none" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Printer ¶
func NewPrinter ¶
func NewPrinter() *Printer
Creates a new printer, including setting up the default logger.
func (*Printer) Debug ¶
Print a Debug level log through the "slog" package. If the verbosity level is not Debug, it does nothing
func (*Printer) Error ¶
Print an Error level output to the defined Err output (falling back to Stderr if not set).
func (*Printer) Info ¶
Print an Info level output to the defined Err output (falling back to Stderr if not set). If the verbosity level is not Debug or Info, it does nothing.
func (*Printer) Outputf ¶
Print an output using Printf to the defined output (falling back to Stderr if not set). If output format is set to none, it does nothing
func (*Printer) Outputln ¶
Print an output using Println to the defined output (falling back to Stderr if not set). If output format is set to none, it does nothing
func (*Printer) PagerDisplay ¶ added in v0.2.3
Shows the content in the command's stdout using the "less" command If output format is set to none, it does nothing
func (*Printer) PromptForConfirmation ¶
Prompts the user for confirmation.
Returns nil only if the user (explicitly) answers positive. Returns ErrAborted if the user answers negative.
func (*Printer) PromptForEnter ¶ added in v0.3.0
Prompts the user for confirmation by pressing Enter.
Returns nil only if the user (explicitly) press directly enter. Returns ErrAborted if the user press anything else before pressing enter.