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

Adds ProgressBar#puts #56

Merged
merged 2 commits into from Sep 6, 2020
Merged

Adds ProgressBar#puts #56

merged 2 commits into from Sep 6, 2020

Conversation

paul
Copy link
Owner

@paul paul commented Aug 30, 2020

Adds support to print messages without interfering with the output of the bar.

See README and examples/printing_messages.rb.

Some long text
that contains newlines
Halfway there!
Almost done!
[##################################] [100/100] [100%] [00:10] [00:00] [  9.98/s]

@paul paul mentioned this pull request Aug 30, 2020
lib/progress_bar.rb Show resolved Hide resolved
lib/progress_bar.rb Show resolved Hide resolved
spec/print_spec.rb Outdated Show resolved Hide resolved
spec/print_spec.rb Outdated Show resolved Hide resolved
spec/print_spec.rb Outdated Show resolved Hide resolved
spec/print_spec.rb Outdated Show resolved Hide resolved
@paul
Copy link
Owner Author

paul commented Sep 4, 2020

@TRex22 @BenjiWiebe I'll probably merge and release this weekend, but I wanted to see if you had any thoughts before I do.

@TRex22
Copy link

TRex22 commented Sep 4, 2020

Cool Ill look over now

Copy link

@TRex22 TRex22 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Yeah looks good to me...

The reason I used log and not puts was around the fact that it does not behave exactly like puts does. i.e. puts prints given text and then a new line. Here it's kind of printing above the progress bar. More of a philosophical reason

README.mkd Show resolved Hide resolved
@paul
Copy link
Owner Author

paul commented Sep 4, 2020

@TRex22 The reason I chose puts is because of the symmetry with other IO-like object in Ruby. I don't know if we will, but it might be nice if you could supply an instance of ProgressBar in place of other things like $stdout that expect to be able to puts, and it wouldn't be too hard to add print and write, should the need arise.

Allows one to print log messages without interfering with the output of
the ProgressBar.
I think the code is cleaner in these cases with concatentation
@paul paul merged commit dae0f94 into master Sep 6, 2020
@paul paul deleted the feature/print branch September 6, 2020 20:47
@ppkn
Copy link

ppkn commented Oct 28, 2020

Is this going to get rolled up into a release?

@paul
Copy link
Owner Author

paul commented Oct 29, 2020

@ppkn I think I was waiting for feedback in the other PRs, then forgot all about it. I'll cut a new release today!

@paul
Copy link
Owner Author

paul commented Oct 29, 2020

@ppkn done, released 1.3.2: https://rubygems.org/gems/progress_bar

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

Successfully merging this pull request may close these issues.

None yet

3 participants