18 Commits

Author SHA1 Message Date
Samuele Pedroni
f83b1f1560 many: progress bars should use the overridable stdouts (#12047)
making progress bars should take a stdout io.Writer

ToolingStore should carry an overridable stdout

make sure in image, preseed and cmd/snap code the overridable
top-level Stdout is passed along to make progress bars
2022-08-18 11:34:35 +02:00
John R. Lenton
06e83b2e0e add unit tests for ansimeter; some tweaks for quantity corner cases 2017-10-06 13:54:57 +01: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
Michael Vogt
54cb5010c3 fix Notify() output/tests 2016-04-28 07:43:22 +02:00
Michael Vogt
e5193a017b fix unit test 2016-04-14 20:34:24 +02:00
Michael Vogt
d997e6230a merged lp:snappy and resolved conflicts 2015-06-08 16:25:07 +02:00
Michael Vogt
97b274a12a merged lp:~mvo/snappy/snappy-lp1449032-poor-mans-rsync-15.04 2015-06-03 13:48:37 +02:00
Sergio Schvezov
866aa92c6b Update in-code documentation 2015-06-02 17:53:10 -03:00
Sergio Schvezov
9d9bd96780 Forget gocheck 2015-06-02 17:46:07 -03:00
Michael Vogt
6cabf4bf80 progress/progress_test.go: fix test 2015-05-29 15:41:55 +02:00
Michael Terry
14898a953e Add modelines 2015-05-15 09:33:27 -04:00
Michael Vogt
dde55f9835 move pkgname out of progress interface and move it into "Start()" 2015-05-06 14:26:38 +02:00
James Hunt
4c6d47bef3 * Reset attachedToTerminal() using defer. 2015-04-22 11:46:52 +01:00
James Hunt
e71d08f9be * TestMakeProgressBar(): reset attachedToTerminal(). 2015-04-22 11:38:14 +01:00
James Hunt
df894acf1b * Review changes: moved MakeProgressBar() to progress/. 2015-04-21 16:52:02 +01:00
John R. Lenton
2d0d646083 s/status/notify/ as per a very good suggestion from Sergio 2015-04-07 12:43:27 +01:00
John R. Lenton
7f75ff88b4 Add a Status() call to progress.Meter 2015-04-03 00:51:25 +01:00
John R. Lenton
365363b5ee move progress to its own package 2015-04-03 00:42:34 +01:00