Continuously changing a terminal line

#1

Well, not sure if the title is clear or misleading.
I want to have a line in the terminal as attached, where the text/messege after the %ge indicator keep changing, as well as the percentage indicator, without creating new line! thanks

0 Likes

#2

The crude way to do this is to just write a carriage return ('\r'), no newline ('\n'), so further output overwrites what was on the line before. More advanced methods would require terminal-specific escape codes for exact cursor positioning. There’s probably a crate for that though…

2 Likes

#3

I like indicatif or pbr for progress bars, you might want console for styling.

3 Likes

#4

+1 for indicatif, which supports exactly this use directly

0 Likes