progressbar icon indicating copy to clipboard operation
progressbar copied to clipboard

Multiple progress bars at once

Open nektro opened this issue 6 years ago • 14 comments

Or would this unfortunately fall under #6 and multi-line in-compatibility?

nektro avatar Jul 14 '19 01:07 nektro

Yes, unless you know a way of doing it that works in Windows? That would be great!

schollz avatar Jul 14 '19 03:07 schollz

Just for anyone who is thinking about implementing this, you can do this easily in a OS agnostic way. Store the bars in a slice and loop over them at render time.

MrMe42 avatar Jul 14 '19 16:07 MrMe42

But for the display I was more thinking

  80% |████████████████████████████████        | [1s:0s]
  25% |███████████                             | [1s:0s]

which requires multiple line functionality. Would this still be possible with slices?

nektro avatar Jul 14 '19 17:07 nektro

The program rclone is able to achieve multi line overwrites and is cross platform. The applicable code is here https://github.com/ncw/rclone/blob/master/cmd/progress.go#L73. I'm unsure at this time how transferable the code would be to progressbar.

nektro avatar Jul 17 '19 20:07 nektro

image Another example, last one, this is docker pull

nektro avatar Jul 21 '19 07:07 nektro

This looks like https://github.com/gosuri/uiprogress but it's kind of hard to use.

gonejack avatar Jan 29 '21 15:01 gonejack

That would be a cool feature

T1MOXA avatar Apr 22 '21 11:04 T1MOXA

Hi all. I'm not going to personally implement this - I've never had a reason to use multiple bars. But I will accept any PR that does implement this.

schollz avatar Apr 14 '22 16:04 schollz

I made a simple, i mean a really simple, multi progressbar using a wrapper. Of course you can only use one io.Writer for all bars, makes sense though and i only tested it with os.Stdout. There are better solutions, but this one was fast and covers my use case.

Feel free to adapt.

https://gist.github.com/IceflowRE/e4c2b9163a697105a3e72f35f0cd12a5

IceflowRE avatar Feb 08 '23 20:02 IceflowRE

https://github.com/IceflowRE/go-multiprogressbar

You can try it out! Maybe this will encourage others to give some thoughts. (Also this does not mean, iam not interested in putting this feature into this library, just that i do not know if this would be the right way and the quality is not as high as it should be.)

IceflowRE avatar Feb 09 '23 20:02 IceflowRE

There's another package that supports multiple bars: https://github.com/jedib0t/go-pretty/tree/main/progress. It's a bit more code to use, I prefer schollz approach

MrMarble avatar Feb 12 '23 10:02 MrMarble

There's another package that supports multiple bars: https://github.com/jedib0t/go-pretty/tree/main/progress. It's a bit more code to use, I prefer schollz approach

Well thats why my package exists, not sure if you saw that, each bar of the multiple one is a schollz bar.

IceflowRE avatar Feb 12 '23 11:02 IceflowRE

@IceflowRE thanks for your contribution 👍 Is there a reason that it is a separate package and not a PR? Try to understand if there are any downsides or something missing. 🙌

fentas avatar Feb 25 '24 10:02 fentas

@IceflowRE thanks for your contribution 👍 Is there a reason that it is a separate package and not a PR? Try to understand if there are any downsides or something missing. 🙌

Its working for my simple use cases (using stdout), but never tested or tried to solve other cases. Also i did not wrote tests. Personally i would expect from a PR a bit more than that tbh.

IceflowRE avatar Feb 25 '24 16:02 IceflowRE