rsalmei / alive-progress

A new kind of Progress Bar, with real-time throughput, ETA, and very cool animations!
MIT License
5.53k stars 206 forks source link

Spinner for a running command #117

Closed GlenNicholls closed 2 years ago

GlenNicholls commented 2 years ago

Referencing the example in the docs:

with alive_bar(total) as bar:  # declare your expected total
    for item in items:         # <<-- your original loop
        print(item)            # process each item
        bar()                  # call `bar()` at the end

the cool bar.text('message'), which sets a situational message right within the bar, where you can display something about the current item, or the phase the processing is in;

Is it possible to change the text placement to be above or below the bar? My use-case I believe is kind of unique, I opened an issue on stack overflow about exactly what I'm trying to do. In essence, I would like to display just a spinner for a bash command I'm running and then display the text output from that command as a single line below the bar. Then once the command is done executing, that single line "terminal view" goes away.

rsalmei commented 2 years ago

Yes, alive-progress does support placing texts above it, there's not much sense putting them below, since lines on a terminal run from top to bottom, so the bar has to leave behind all lines printed, like a log. Today I'm releasing the hiding of the final receipt, and together with spinner hiding, which was already supported, you could do it like this:

Untitled

I think it is very cool to show the elapsed time, but you can also remove it if you'd like, as well as the "Please wait" message, like this:

Untitled