Codebase list golang-github-vbauerster-mpb / 6483024
GetWidth godoc Vladimir Bauer 7 years ago
1 changed file(s) with 5 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
2121 clearCursorAndLine = cursorUp + clearLine
2222 )
2323
24 // Writer is a buffered the writer that updates the terminal.
25 // The contents of writer will be flushed when Flush is called.
24 // Writer is a buffered the writer that updates the terminal. The
25 // contents of writer will be flushed when Flush is called.
2626 type Writer struct {
2727 out io.Writer
2828 buf bytes.Buffer
6363 return w.buf.WriteString(s)
6464 }
6565
66 // ReadFrom reads from the provided io.Reader and writes to the underlying buffer.
66 // ReadFrom reads from the provided io.Reader and writes to the
67 // underlying buffer.
6768 func (w *Writer) ReadFrom(r io.Reader) (n int64, err error) {
6869 return w.buf.ReadFrom(r)
6970 }
7071
72 // GetWidth returns width of underlying terminal.
7173 func (w *Writer) GetWidth() (int, error) {
7274 if w.isTerminal {
7375 tw, _, err := terminal.GetSize(w.fd)