Documentation
¶
Index ¶
- type PrintOption
- type Printer
- func (p *Printer) PrintHighlight(msg string, opts ...PrintOption)
- func (p *Printer) PrintHint(msg string, opts ...PrintOption)
- func (p *Printer) PrintInfo(msg string, opts ...PrintOption)
- func (p *Printer) PrintText(msg string, opts ...PrintOption)
- func (p *Printer) PrintlnError(msg string, opts ...PrintOption)
- func (p *Printer) PrintlnHighlight(msg string, opts ...PrintOption)
- func (p *Printer) PrintlnHint(msg string, opts ...PrintOption)
- func (p *Printer) PrintlnInfo(msg string, opts ...PrintOption)
- func (p *Printer) PrintlnSubTitle(title string, opts ...PrintOption)
- func (p *Printer) PrintlnSuccess(msg string, opts ...PrintOption)
- func (p *Printer) PrintlnText(msg string, opts ...PrintOption)
- func (p *Printer) PrintlnTitle(title string, opts ...PrintOption)
- func (p *Printer) PrintlnWarning(msg string, opts ...PrintOption)
- func (p *Printer) Spacer(n int)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PrintOption ¶
type PrintOption func(*printStyle)
PrintOption is a function that modifies a printStyle.
func WithIndent ¶
func WithIndent(level ...int) PrintOption
WithIndent returns a PrintOption that sets the indent level of a printStyle. If no level is provided, the printer's default is used. If the provided level is negative, indentation is disabled.
func WithParagraphMode ¶
func WithParagraphMode() PrintOption
WithParagraphMode returns a PrintOption that sets the indent level of a printStyle to 80 and aligns the text to the left with a margin of 2.
type Printer ¶
type Printer struct {
// contains filtered or unexported fields
}
Printer is a struct that contains a writer and an indent level. It is used to print messages to the terminal.
func NewPrinter ¶
NewPrinter creates a new Printer with the provided writer and optional indent level. If no indent level is provided, a default of 50 is used. If the provided indent level is negative, indentation is disabled.
func (*Printer) PrintHighlight ¶
func (p *Printer) PrintHighlight(msg string, opts ...PrintOption)
PrintHighlight prints a highlighted message to the printer's writer.
func (*Printer) PrintHint ¶
func (p *Printer) PrintHint(msg string, opts ...PrintOption)
PrintHint prints a hint message to the printer's writer.
func (*Printer) PrintInfo ¶
func (p *Printer) PrintInfo(msg string, opts ...PrintOption)
PrintInfo prints an info message to the printer's writer.
func (*Printer) PrintText ¶
func (p *Printer) PrintText(msg string, opts ...PrintOption)
PrintText prints a text message to the printer's writer.
func (*Printer) PrintlnError ¶
func (p *Printer) PrintlnError(msg string, opts ...PrintOption)
PrintlnError prints an error message to the printer's writer with a newline at the end.
func (*Printer) PrintlnHighlight ¶
func (p *Printer) PrintlnHighlight(msg string, opts ...PrintOption)
PrintlnHighlight prints a highlighted message to the printer's writer with a newline at the end.
func (*Printer) PrintlnHint ¶
func (p *Printer) PrintlnHint(msg string, opts ...PrintOption)
func (*Printer) PrintlnInfo ¶
func (p *Printer) PrintlnInfo(msg string, opts ...PrintOption)
PrintlnInfo prints an info message to the printer's writer with a newline at the end.
func (*Printer) PrintlnSubTitle ¶
func (p *Printer) PrintlnSubTitle(title string, opts ...PrintOption)
PrintlnSubTitle prints a subtitle to the printer's writer with a newline at the end.
func (*Printer) PrintlnSuccess ¶
func (p *Printer) PrintlnSuccess(msg string, opts ...PrintOption)
PrintlnSuccess prints a success message to the printer's writer with a newline at the end.
func (*Printer) PrintlnText ¶
func (p *Printer) PrintlnText(msg string, opts ...PrintOption)
PrintlnText prints a text message to the printer's writer with a newline at the end.
func (*Printer) PrintlnTitle ¶
func (p *Printer) PrintlnTitle(title string, opts ...PrintOption)
PrintlnTitle prints a title to the printer's writer with a newline at the end.
func (*Printer) PrintlnWarning ¶
func (p *Printer) PrintlnWarning(msg string, opts ...PrintOption)
PrintlnWarning prints a warning message to the printer's writer with a newline at the end.