Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enum plugable bar #19

Open
kelvinst opened this issue Sep 5, 2017 · 1 comment
Open

Enum plugable bar #19

kelvinst opened this issue Sep 5, 2017 · 1 comment

Comments

@kelvinst
Copy link
Contributor

kelvinst commented Sep 5, 2017

It would be awesome to have an easy way to plug this in a Enum/Stream/Flow pipeline. Since nowadays we have to do something like:

count = length(list)

list
|> Stream.with_index(1)
|> Stream.map(fn({item, idx}) ->
  ProgressBar.render(idx, count)
  item
end)
|> process_list

What I suggest is something like:

list
|> ProgressBar.from_enumerable(progress_bar_opts)
|> process_list

Together with progress_bar_opts, I guess it would be a good thing if we ask the count, since then the length can be calculated only once and for all.

I would be glad to open a PR, but maybe I will not be able to do it soon.

@henrik
Copy link
Owner

henrik commented Sep 29, 2017

Great idea!

m1ome added a commit to m1ome/progress_bar that referenced this issue Jul 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants