Closed rberrelleza closed 4 years ago
@rberrelleza is there an example how to hook it with Http client?
@tuananh I wrote a quick one here based on how we use it in okteto: https://gist.github.com/rberrelleza/29daea3dffd20e7a28dd8948b4c2cfbc
another option could be to use https://github.com/hashicorp/go-getter. Which is something we could even use more broadly, since it automatically deals with unzipping and things like that.
@alexellis what's your thought on this?
Which specific binaries were causing you to question whether the command worked?
I don't know if I'm spoiled with 100mbps internet, but I've not seen this as a concern so far and know how tricky animations become once applied to CI / headless scripts / Jenkins etc..
@alexellis it happened with kubectl. I installed it this morning and it took 8-12 seconds, without any output. Maybe is just my internet that is slow 🤷
AFAIK over 7s without new output is where humans get worried that it's broken.
We could do a CI-friendly printing .
every 500 ms, or checkout your suggested progress bar.
I also put something together a little while ago https://github.com/alexellis/cli-progress-animation
I remember issues with CI being a problem, along with issues with Windows and cmd.exe.
There may be some way to detect if it's a proper terminal and then not print output, or only print dots?
I just tried out your gist @rberrelleza - it looks nice.
Do you know why it didn't "complete" though?
kosmos:29daea3dffd20e7a28dd8948b4c2cfbc alex$ go run main.go
55.94 MB / 58.50 MB [------------------------------------------------>__] 95.63%kosmos:29daea3dffd20e7a28dd8948b4c2cfbc alex$
The second run was a little different too
kosmos:29daea3dffd20e7a28dd8948b4c2cfbc alex$ go run main.go
2020/08/29 10:18:48 Total 58498048
58.11 MB / 58.50 MB [----------------------------------------------------------------------------------------------------------------------------------->] 99.33%2020/08/29 10:18:54 Total p 58498048
kosmos:29daea3dffd20e7a28dd8948b4c2cfbc alex$
@alexellis i's most likely finishing the writing before the animation is done. In okteto
we added a check at the end to give it smother experience.
@rberrelleza would you send a PR for this? There should also be some kind of env-var to turn it off like ARKADE_PROGRESS=0
Yep, assign the ticket to me.
Can't assign it to you, but feel free to PR like the gist.
It would be useful to have a progress bar when arkade is downloading a binary.
Expected Behaviour
When a binary is being downloaded, arkade could show the speed, size and percentage of completion.
Current Behaviour
Today, nothing is shown. For large binaries, it's hard to tell if the download is working on ot.
Possible Solution
At okteto, we've had success using https://github.com/cheggaaa/pb/ for this