console-rs / indicatif

A command line progress reporting library for Rust
MIT License
4.21k stars 238 forks source link

Use with Zenity #624

Closed wildwestrom closed 4 months ago

wildwestrom commented 4 months ago

I'd like to use indicatif but instead of outputting to a terminal, I'd like to output to zenity. I was thinking of contributing to the project so I can integrate nicely with the API, but I'm having trouble finding where all the actual drawing happens.

To summarize, I'd like to:

  1. Make a feature in which the progress bar will be displayed to a zenity progress indicator. In other words: std::process::Command::new("zenity").arg("--progress").
  2. Know if this feature is welcome.
  3. Understand where I need to make changes in order to implement this.
djc commented 4 months ago

What is Zenity? How is it controlled?

wildwestrom commented 4 months ago

Zenity is a command line tool that allows for making graphical dialog windows easily. It only works on Linux, but it's simple to use.

In particular the progress bar (zenity --progress) is fed line-by-line using standard input (a line with a number between 1-100 for the progress bar itself and a line preceded by # for messages).

I suppose you could make this work for other command line tools that take input from, but before I generalize, I'd just like to see if I can start to make this work.

Example Image

djc commented 4 months ago

Since this seems relatively niche, I'm not inclined to support this as part of this crate. It should be pretty straightforward with a custom ProgressStyle to support this.

wildwestrom commented 4 months ago

Alright, thank you for your input. I'll try to figure this out.

wildwestrom commented 4 months ago

Now, what about making this library generally compatible with graphical windows? I still think this is a good idea, but I understand if you'd rather keep this a terminal only library.

djc commented 4 months ago

Again, that's a very abstract proposal. I really can't judge it without a better idea of what it would concretely require (me to maintain).

wildwestrom commented 4 months ago

Admittedly, what I have in mind would be a lot to maintain. I'll close this for now, but if I come up with a solution that works I'll come back. Thank you for taking the time to discuss with me.