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