Documentation ¶
Overview ¶
Package output implements the logic to dealing with the commands output.
Index ¶
- Constants
- Variables
- func ExitOnErr(err error)
- func PrettyErr(err error) string
- type Printer
- func (p *Printer) BoxPrintln(text string)
- func (p *Printer) BoxSetTitle(title string)
- func (p *Printer) BulletListAddItemWithBullet(msg string, level int)
- func (p *Printer) BulletListAddItemWithoutBullet(msg string, level int)
- func (p *Printer) BulletListSprintForBox() string
- func (p *Printer) CheckErr(err error)
- func (p *Printer) ExitWithMessage(errmsg string)
- func (p *Printer) StartSpinner(text ...interface{}) *pterm.SpinnerPrinter
- func (p *Printer) Verbosef(format string, args ...interface{})
- type Section
Constants ¶
const ( // CheckMark is the unicode checkmark. CheckMark = "✔" // Cross is the unicode cross. Cross = "✖" )
Variables ¶
var ( // StatusSectionStyle is the style of the status section. StatusSectionStyle = pterm.NewStyle(pterm.FgMagenta, pterm.Bold) // StatusSectionSuccessStyle is the style of the success status section. StatusSectionSuccessStyle = pterm.NewStyle(pterm.FgGreen, pterm.Bold) // StatusSectionFailureStyle is the style of the failure status section. StatusSectionFailureStyle = pterm.NewStyle(pterm.FgRed, pterm.Bold) // StatusSectionInfoStyle is the style of the info status section. StatusSectionInfoStyle = pterm.NewStyle(pterm.FgDefault, pterm.Bold) // StatusDataStyle is the style of the status data. StatusDataStyle = pterm.NewStyle(pterm.FgLightYellow, pterm.Bold) // StatusInfoStyle is the style of the status info. StatusInfoStyle = pterm.NewStyle(pterm.FgCyan, pterm.Bold) // BoxTitleStyle is the style of the box. BoxTitleStyle = pterm.NewStyle(pterm.FgMagenta, pterm.Bold) )
Functions ¶
Types ¶
type Printer ¶
type Printer struct { Info *pterm.PrefixPrinter Success *pterm.PrefixPrinter Warning *pterm.PrefixPrinter Error *pterm.PrefixPrinter BulletList *pterm.BulletListPrinter Section *pterm.SectionPrinter Paragraph *pterm.ParagraphPrinter // contains filtered or unexported fields }
Printer manages all kinds of outputs.
func NewFakePrinter ¶
NewFakePrinter returns a new printer to be used in tests.
func NewLocalPrinter ¶
NewLocalPrinter returns a new printer referring to the local cluster.
func NewRemotePrinter ¶
NewRemotePrinter returns a new printer referring to the remote cluster.
func (*Printer) BoxPrintln ¶
BoxPrintln prints a message through the box printer.
func (*Printer) BoxSetTitle ¶
BoxSetTitle sets the title of the box.
func (*Printer) BulletListAddItemWithBullet ¶
BulletListAddItemWithBullet adds a new message to the BulletListPrinter.
func (*Printer) BulletListAddItemWithoutBullet ¶
BulletListAddItemWithoutBullet adds a new message to the BulletListPrinter.
func (*Printer) BulletListSprintForBox ¶
BulletListSprintForBox prints the bullet list for the box.
func (*Printer) CheckErr ¶
CheckErr prints a user friendly error and exits with a non-zero exit code. If a spinner is currently active, then it is leveraged to print the message, otherwise it outputs the message through the printer or, if nil, to STDERR.
func (*Printer) ExitWithMessage ¶ added in v0.5.4
ExitWithMessage prints the error message and exits with a non-zero exit code.
func (*Printer) StartSpinner ¶
func (p *Printer) StartSpinner(text ...interface{}) *pterm.SpinnerPrinter
StartSpinner starts a new spinner.
type Section ¶
type Section interface { AddSection(title string) Section AddSectionSuccess(title string) Section AddSectionFailure(title string) Section AddSectionInfo(title string) Section AddSectionWithDetail(title, detail string) Section AddEntry(key string, values ...string) Section AddEntryWithoutStyle(key, value string) Section SprintForBox(printer *Printer) string }
Section is a section of the output.