File tree Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -54,15 +54,12 @@ progress() {
5454 local bar_left
5555 bar_left=$( printf " %${left} s" )
5656
57- # If no leftover space remains, we have presumably reached 100%.
58- if [ " $left " -eq 0 ]; then
59- # Clear the existing progress line
60- printf " \r\033[K"
61- # FIXME: remove this hack to print the final 100% bar with a newline
62- printf " Progress: [########################################] 100%%\n"
63- else
64- # Update the bar in place (no extra newline)
65- printf " \rProgress: [${bar_done// /# }${bar_left// / -} ] ${percentage} %%"
57+ # Print the progress bar in a single line, updating it dynamically.
58+ printf " \rProgress: [%s%s] %d%%" " ${bar_done// /# } " " ${bar_left// / -} " " $percentage "
59+
60+ # When reaching 100%, automatically print a newline to finalize the output.
61+ if [ " $percentage " -eq 100 ]; then
62+ printf " \n"
6663 fi
6764}
6865
You can’t perform that action at this time.
0 commit comments