File tree 1 file changed +6
-9
lines changed
1 file changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -54,15 +54,12 @@ progress() {
54
54
local bar_left
55
55
bar_left=$( printf " %${left} s" )
56
56
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"
66
63
fi
67
64
}
68
65
You can’t perform that action at this time.
0 commit comments