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

Support for multi-line progress messages #442

Closed
happenslol opened this issue Jun 10, 2022 · 4 comments
Closed

Support for multi-line progress messages #442

happenslol opened this issue Jun 10, 2022 · 4 comments

Comments

@happenslol
Copy link
Contributor

First of all, thanks for the awesome library! It's been a joy to use so far.

Recently, I've had a few usecases where my CLI apps are running bash scripts or something similar in the background. Of course, I could just show an indeterminate progress spinner here to show that a script is running. However, after using buildkit, which basically shows the last few lines of output for each step being run, and clears them when the step is done, I thought about how to achieve this with this library.

The simplest way to show recent output for progress bars would be to just have multiline progress bars. I could then take e.g. the last three lines of the script output and display them below the progress message. I tried this but newlines are not handled at all by indicatif, resulting in duplicated lines whenever a newline is printed.

I would be open to working on this if this functionality is something you would consider adding in this library. If you need more details or examples of this behavior in other CLI tools, I can provide that.

@djc
Copy link
Collaborator

djc commented Jun 13, 2022

Which version did you try? It might be helpful to try the latest 0.17 rc. I'm fairly certain there is at least some newline handling in indicatif, although I haven't really tried it myself. I would definitely be open to have something like this in the library, happy to answer questions about the code base if you have any.

@happenslol
Copy link
Contributor Author

I actually checked out the latest main branch, and tried inserting newlines into a bunch of the examples, which just resulted in a whole lot of output :-P I suppose it's possible that it works for a single progress bar though, I'm not sure I tried that.

I'll have a closer look at the codebase and see if I can whip something up. Thanks!

@happenslol
Copy link
Contributor Author

I've tried to implement this, see #443. I'd be happy about any feedback!

@djc
Copy link
Collaborator

djc commented Nov 15, 2022

This was merged, going to close this.

@djc djc closed this as completed Nov 15, 2022
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