fadeevab / cliclack

Beautiful, minimal, opinionated CLI prompts inspired by the Clack NPM package
MIT License
216 stars 15 forks source link

[feature request] ability to disable the extra newline after each log/prompt #22

Closed cylewitruk closed 7 months ago

cylewitruk commented 7 months ago

For when we might want to show a sequence of steps happening "unbroken", likely together with spinners (or progress bars! :wink: ). Example:

▲  This operation can take a while and consume a lot of disk space.
│  Estimated disk space usage: ~2.3GB
│  
◇  Are you sure you want to continue?
│  Yes 
│
│ ✔ Files downloaded
│ ✔ Images built
│ [spinner] Copying files... 123.45MB / 2.3GB (5%)

... ish

fadeevab commented 7 months ago

@cylewitruk If we exclude spinners from the equation, you still could use \n like this log::success("Result:\n✔ Files downloaded\n✔ Images built")?;

┌   log 
│
◆  Result:
│  ✔ Files downloaded
│  ✔ Images built
│ 

What do you think?

cylewitruk commented 7 months ago

@cylewitruk If we exclude spinners from the equation, you still could use \n like this log::success("Result:\n✔ Files downloaded\n✔ Images built")?;

┌   log 
│
◆  Result:
│  ✔ Files downloaded
│  ✔ Images built
│ 

What do you think?

That won't really work for me because I want to show them in real-time as they're happening (including spinners and progress bars), and tick them off one-by-one as part of a "group". The above would require that I wait until all is done to print.

cylewitruk commented 7 months ago

@fadeevab After having spent time on the multiprogress bar, I wonder if this could simply be a new "progress type" in a multi progress prompt? Besides download/progress I would want 1) spinner, and 2) "waiting" (no animation, just indicating that it's a step that's waiting, for example download must complete before extracting files).

I did add as_spinner() to multiprogress locally, but ran into problems with the animation. I'm starting to think that long-term the direct dependency on indicatif should be dropped and we just take some inspiration from them, but that cliclack is responsible for all rendering even for progress/download/spinner/etc.

Spontaneous thoughts?

fadeevab commented 7 months ago

@cylewitruk Is it still actual?

cylewitruk commented 7 months ago

@cylewitruk Is it still actual?

@fadeevab yeah, at least for log lines -- I'm switching over to the new multiprogress now which solves my needs there :smile:

I might be able to solve it all with multi_progress though -- so don't do anything yet, I'll play with it and see if it works first.

cylewitruk commented 7 months ago

Closing this for now as I've been able to work around not having this built-in