Codebase list golang-github-vbauerster-mpb / 16b2f63
periods Vladimir Bauer 6 years ago
1 changed file(s) with 5 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
99 "golang.org/x/crypto/ssh/terminal"
1010 )
1111
12 // NotATTY not a TeleTYpewriter error
12 // NotATTY not a TeleTYpewriter error.
1313 var NotATTY = errors.New("not a terminal")
1414
1515 var cuuAndEd = fmt.Sprintf("%c[%%dA%[1]c[J", 27)
2424 isTerminal bool
2525 }
2626
27 // New returns a new Writer with defaults
27 // New returns a new Writer with defaults.
2828 func New(out io.Writer) *Writer {
2929 w := &Writer{out: out}
3030 if f, ok := out.(*os.File); ok {
3434 return w
3535 }
3636
37 // Flush flushes the underlying buffer
37 // Flush flushes the underlying buffer.
3838 func (w *Writer) Flush(lineCount int) (err error) {
3939 if w.lineCount > 0 {
4040 w.clearLines()
4444 return
4545 }
4646
47 // Write appends the contents of p to the underlying buffer
47 // Write appends the contents of p to the underlying buffer.
4848 func (w *Writer) Write(p []byte) (n int, err error) {
4949 return w.buf.Write(p)
5050 }
5151
52 // WriteString writes string to the underlying buffer
52 // WriteString writes string to the underlying buffer.
5353 func (w *Writer) WriteString(s string) (n int, err error) {
5454 return w.buf.WriteString(s)
5555 }