Closed TRex22 closed 5 years ago
Hi @TRex22,
Thanks for taking the time to submit a PR! Lots of good ideas here. Some of them, though, I'm not OK with. Do you mind making a few separate PRs for this instead? I would accept PRs that add support for colors and for changing the bar character. I'm also not sure what you mean by "the ability to log above the progress_bar without affecting it", could you provide an example?
However, I don't want to change the primary interface. 99% of the time, the way ProgressBar is used is to take a single argument which is the size of the incrementing counter, and I don't want that to change.
bar = ProgressBar.new(100)
xs.each { bar.increment! }
I think we can still accomplish what you want with keyword args, though. Something like this?
ProgressBar.new(42, color: :blue)
ProgressBar.new(314, bar: "█", delimiters: "||")
Then the initializer looks like this:
def initialize(max, *meters, color: nil, bar: "#", delimiters: "[]")
You can also allow colour:
if you like, but Ruby usually prefers the American spellings. I think it should take the ANSI color name instead of (or in addition to) a number.
Cool perfect. Ill make the changes as soon as I can.
@paul what is your opinion on bumping the version?
@TRex22 If you make the changes additive in the initializer like I mocked up, then we can just do a new minor release, no reason to bump the major version.
What does this PR do?
Why do I want to merge these changes?
I found this library by chance - and it worked better than a few others for my use case. I know in the readme it says its feature complete but using it actively I found that not being able to change the characters or properly log to
STDOUT
greatly diminished the usefulness of the library.In order to add these features I found I needed to change the main interface - there were other options available to me but I felt this was the cleanest solution