diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2019-12-19 13:29:25 -0500 |
---|---|---|
committer | Daniel J Walsh <dwalsh@redhat.com> | 2019-12-20 09:30:47 -0500 |
commit | 50ece79387dcf6c748e3ae1bd6a7067059c0dfe3 (patch) | |
tree | 6b30c4f66f7be315ff2257447be3818be98fb50f /vendor/github.com/vbauerster/mpb/cwriter/writer.go | |
parent | a359ca0d1825859dd8b7c1384f11d703ec6625b4 (diff) | |
download | podman-50ece79387dcf6c748e3ae1bd6a7067059c0dfe3.tar.gz podman-50ece79387dcf6c748e3ae1bd6a7067059c0dfe3.tar.bz2 podman-50ece79387dcf6c748e3ae1bd6a7067059c0dfe3.zip |
build(deps): bump github.com/containers/image/v5 from 5.0.0 to 5.1.0
Bumps [github.com/containers/image/v5](https://github.com/containers/image) from 5.0.0 to 5.1.0.
- [Release notes](https://github.com/containers/image/releases)
- [Commits](https://github.com/containers/image/compare/v5.0.0...v5.1.0)
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'vendor/github.com/vbauerster/mpb/cwriter/writer.go')
-rw-r--r-- | vendor/github.com/vbauerster/mpb/cwriter/writer.go | 80 |
1 files changed, 0 insertions, 80 deletions
diff --git a/vendor/github.com/vbauerster/mpb/cwriter/writer.go b/vendor/github.com/vbauerster/mpb/cwriter/writer.go deleted file mode 100644 index 638237c18..000000000 --- a/vendor/github.com/vbauerster/mpb/cwriter/writer.go +++ /dev/null @@ -1,80 +0,0 @@ -package cwriter - -import ( - "bytes" - "errors" - "fmt" - "io" - "os" - - isatty "github.com/mattn/go-isatty" - "golang.org/x/crypto/ssh/terminal" -) - -// ESC is the ASCII code for escape character -const ESC = 27 - -var NotATTY = errors.New("not a terminal") - -var ( - cursorUp = fmt.Sprintf("%c[%dA", ESC, 1) - clearLine = fmt.Sprintf("%c[2K\r", ESC) - clearCursorAndLine = cursorUp + clearLine -) - -// Writer is a buffered the writer that updates the terminal. The -// contents of writer will be flushed when Flush is called. -type Writer struct { - out io.Writer - buf bytes.Buffer - isTerminal bool - fd int - lineCount int -} - -// New returns a new Writer with defaults -func New(out io.Writer) *Writer { - w := &Writer{out: out} - if f, ok := out.(*os.File); ok { - fd := f.Fd() - w.isTerminal = isatty.IsTerminal(fd) - w.fd = int(fd) - } - return w -} - -// Flush flushes the underlying buffer -func (w *Writer) Flush(lineCount int) error { - err := w.clearLines() - w.lineCount = lineCount - // WriteTo takes care of w.buf.Reset - if _, e := w.buf.WriteTo(w.out); err == nil { - err = e - } - return err -} - -// Write appends the contents of p to the underlying buffer -func (w *Writer) Write(p []byte) (n int, err error) { - return w.buf.Write(p) -} - -// WriteString writes string to the underlying buffer -func (w *Writer) WriteString(s string) (n int, err error) { - return w.buf.WriteString(s) -} - -// ReadFrom reads from the provided io.Reader and writes to the -// underlying buffer. -func (w *Writer) ReadFrom(r io.Reader) (n int64, err error) { - return w.buf.ReadFrom(r) -} - -// GetWidth returns width of underlying terminal. -func (w *Writer) GetWidth() (int, error) { - if w.isTerminal { - tw, _, err := terminal.GetSize(w.fd) - return tw, err - } - return -1, NotATTY -} |