rfc(pkg): progress indicator for downloads
Problem
When we do:
dune pkg lock
it typically take some time because we are fetching or cloning in the background.
Proposal
We could have a download indicator that looks like the following:
[0.1/5.2 MiB] <spinny thing> Downloading opam-repository https://opam.ocaml.org
This would give users a much better experience when waiting.
Implementation
We use opam libraries to fetch and clone repos. We could modify the calls to git by parsing from git fetch and git clone:
--progress
Progress status is reported on the standard error stream by default when
it is attached to a terminal, unless -q is specified. This flag forces
progress status even if the standard error stream is not directed to a
terminal.
When we have these we then parse and display a nice status.
Related PRs
- Progress indicators on jobs: #8601
- Download friendly byte units: #8618
Looks like a good idea to me. I think this might need modifications to action execution in the engine that will allow progress reporting.
FYI, a couple years ago I had a look at the various HTTP clients and I don't think any had a progress callback. (though that's more of a concern for the opam libs)