MCPcopy
hub / github.com/pterm/pterm / TextPrinter

Interface TextPrinter

interface_text_printer.go:4–48  ·  view source on GitHub ↗

TextPrinter contains methods to print formatted text to the console or return it as a string.

Source from the content-addressed store, hash-verified

2
3// TextPrinter contains methods to print formatted text to the console or return it as a string.
4type TextPrinter interface {
5 // Sprint formats using the default formats for its operands and returns the resulting string.
6 // Spaces are added between operands when neither is a string.
7 Sprint(a ...any) string
8
9 // Sprintln formats using the default formats for its operands and returns the resulting string.
10 // Spaces are always added between operands and a newline is appended.
11 Sprintln(a ...any) string
12
13 // Sprintf formats according to a format specifier and returns the resulting string.
14 Sprintf(format string, a ...any) string
15
16 // Sprintfln formats according to a format specifier and returns the resulting string.
17 // Spaces are always added between operands and a newline is appended.
18 Sprintfln(format string, a ...any) string
19
20 // Print formats using the default formats for its operands and writes to standard output.
21 // Spaces are added between operands when neither is a string.
22 // It returns the number of bytes written and any write error encountered.
23 Print(a ...any) *TextPrinter
24
25 // Println formats using the default formats for its operands and writes to standard output.
26 // Spaces are always added between operands and a newline is appended.
27 // It returns the number of bytes written and any write error encountered.
28 Println(a ...any) *TextPrinter
29
30 // Printf formats according to a format specifier and writes to standard output.
31 // It returns the number of bytes written and any write error encountered.
32 Printf(format string, a ...any) *TextPrinter
33
34 // Printfln formats according to a format specifier and writes to standard output.
35 // Spaces are always added between operands and a newline is appended.
36 // It returns the number of bytes written and any write error encountered.
37 Printfln(format string, a ...any) *TextPrinter
38
39 // PrintOnError prints every error which is not nil.
40 // If every error is nil, nothing will be printed.
41 // This can be used for simple error checking.
42 PrintOnError(a ...any) *TextPrinter
43
44 // PrintOnErrorf wraps every error which is not nil and prints it.
45 // If every error is nil, nothing will be printed.
46 // This can be used for simple error checking.
47 PrintOnErrorf(format string, a ...any) *TextPrinter
48}

Callers 15

PrintMethod · 0.85
PrintlnMethod · 0.85
PrintfMethod · 0.85
PrintflnMethod · 0.85
PrintOnErrorMethod · 0.85
PrintOnErrorfMethod · 0.85
PrintMethod · 0.85
PrintlnMethod · 0.85
PrintfMethod · 0.85
PrintflnMethod · 0.85
PrintOnErrorMethod · 0.85
PrintOnErrorfMethod · 0.85

Implementers 9

CenterPrintercenter_printer.go
BasicTextPrinterbasic_text_printer.go
PrefixPrinterprefix_printer.go
HeaderPrinterheader_printer.go
BoxPrinterbox_printer.go
ParagraphPrinterparagraph_printer.go
RGBStylergb.go
RGBrgb.go
SectionPrintersection_printer.go

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…