Documentation ¶
Index ¶
- func Fprint(w io.Writer, args ...interface{}) (n int, err error)
- func Fprintf(w io.Writer, format string, args ...interface{}) (n int, err error)
- func Fprintln(w io.Writer, args ...interface{}) (n int, err error)
- func Print(args ...interface{}) (n int, err error)
- func Printf(format string, args ...interface{}) (n int, err error)
- func Println(args ...interface{}) (n int, err error)
- func Sprint(args ...interface{}) string
- func Sprintf(format string, args ...interface{}) string
- func Sprintln(args ...interface{}) string
- func TerminalHeight(fw FileWriter) int
- func TerminalSize(fw FileWriter) (w, h int)
- func TerminalWidth(fw FileWriter) int
- type FileWriter
- type Printer
- type Renderable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Fprint ¶
Fprint formats using the default formats for its operands and writes to w. Spaces are added between operands when neither is a string. It returns the number of bytes written and any write error encountered.
func Fprintf ¶
Fprintf formats according to a format specifier and writes to w. It returns the number of bytes written and any write error encountered.
func Fprintln ¶
Fprintln formats using the default formats for its operands and writes to w. Spaces are always added between operands and a newline is appended. It returns the number of bytes written and any write error encountered.
func Print ¶
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.
func Printf ¶
Printf formats according to a format specifier and writes to standard output. It returns the number of bytes written and any write error encountered.
func Println ¶
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.
func Sprint ¶
func Sprint(args ...interface{}) string
Sprint formats using the default formats for its operands and returns the resulting string. Spaces are added between operands when neither is a string.
func Sprintln ¶
func Sprintln(args ...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.
func TerminalHeight ¶
func TerminalHeight(fw FileWriter) int
TerminalHeight returns the terminal height of given FileWriter.
func TerminalSize ¶
func TerminalSize(fw FileWriter) (w, h int)
TerminalSize returns the terminal width and height of given FileWriter.
func TerminalWidth ¶
func TerminalWidth(fw FileWriter) int
TerminalWidth returns the terminal width of given FileWriter.
Types ¶
type FileWriter ¶
FileWriter is an io.Writer which also provides access to the file descriptor. The interface is satisfied by *os.File.
type Printer ¶
Printer wraps an io.Writer for writing colorful strings to it.
func NewPrinter ¶
NewPrinter returns a new *Printer which writes to w.
func (*Printer) Print ¶
Print formats using the default formats for its operands and writes to the underlying io.Writer. Spaces are added between operands when neither is a string. It returns the number of bytes written and any write error encountered.
func (*Printer) Printf ¶
Printf formats according to a format specifier and writes to the underlying io.Writer. It returns the number of bytes written and any write error encountered.
type Renderable ¶
type Renderable interface { // Measure returns a width measurement which indicates the minimum and // maximum widths required to correctly render the Renderable. The passed // in maxWidth value indicates the maximum usable width. Measure(maxWidth int) measure.Measurement // Render renders the Renderable using the given width. If width is not // within the bounds returned by Measure, the rendered result may be // undefined. Render(width int) string }
Renderable is an object that can be rendered to a console.