Commit Graph

2 Commits

Author SHA1 Message Date
John R. Lenton
67a6df271f many: add copyright header 2017-09-26 07:02:11 -04:00
John R. Lenton
e67a2c0ddc many: implement our own ANSI-escape-using progress indicator
This introduces a `progress.Meter` written from "scratch" (mostly based on
previous work and experiments I did on IO progress bars and fixed-width
displays). It's called `progress.ANSIMeter`.

We were using a `progress.NullProgress` in situations where we actually didn't
want progress bars but still wanted notifications, so `progress.QuietMeter` is a
`progress.Meter` that does that, and that is returned by
`progress.MakeProgressBar()` when it doesn't think we have an actual terminal.

We were replacing `os.Stdout` to look at the output of progress bars, so I wrote
`progresstest.Meter` that just records what it's told instead of printing it
anywhere, and use it in some places.

I renamed `progress.NullProgress` to `progress.NullMeter`, and added
`progress.Null` as a default `progress.NullMeter`; as it's a `struct{}`, it
doesn't make sense not to use that (we were using `&progress.NullMeter{}` in
many many tests).

`image` was not calling `Finished()` on the progress bar, so I added code for it to
do that both in the sane case and in the case the user `^C`'s out.
2017-09-25 17:36:11 -04:00