Merge branch 'main' of https://gitea.virtnet.bond/Joseph.Rawlings/Virtnet.bond
This commit is contained in:
25
gitsync.sh
25
gitsync.sh
@@ -50,9 +50,7 @@ draw_bar() {
|
|||||||
local width=$2
|
local width=$2
|
||||||
local text="$3"
|
local text="$3"
|
||||||
|
|
||||||
# Strip color codes for length calculation
|
|
||||||
local clean_text=$(echo -ne "$text" | sed 's/\x1b\[[0-9;]*m//g')
|
local clean_text=$(echo -ne "$text" | sed 's/\x1b\[[0-9;]*m//g')
|
||||||
|
|
||||||
[ ${#clean_text} -gt $width ] && clean_text="${clean_text:0:$width}"
|
[ ${#clean_text} -gt $width ] && clean_text="${clean_text:0:$width}"
|
||||||
|
|
||||||
local filled=$(( percent * width / 100 ))
|
local filled=$(( percent * width / 100 ))
|
||||||
@@ -97,21 +95,24 @@ run_deployment() {
|
|||||||
done
|
done
|
||||||
wait "$pid"
|
wait "$pid"
|
||||||
|
|
||||||
# Fill bar to end of step
|
|
||||||
echo -ne "\r$(draw_bar $step_percent_end $BAR_WIDTH "$step_name")$CLEAR_LINE"
|
echo -ne "\r$(draw_bar $step_percent_end $BAR_WIDTH "$step_name")$CLEAR_LINE"
|
||||||
done
|
done
|
||||||
|
|
||||||
# Final green completion bar
|
# Final green completion bar
|
||||||
final_text="Deployment Complete"
|
final_text="Deployment Complete"
|
||||||
# Construct bar normally
|
final_bar=$(draw_bar 100 $BAR_WIDTH "$final_text")
|
||||||
bar=$(draw_bar 100 $BAR_WIDTH "$final_text")
|
|
||||||
# Replace the visible text in the middle with green text
|
# Find start index of text inside brackets (exclude leading '[')
|
||||||
clean_text_len=${#final_text}
|
text_len=${#final_text}
|
||||||
start=$(( (BAR_WIDTH - clean_text_len) / 2 + 1 )) # +1 for the [
|
bar_only=${final_bar:1:BAR_WIDTH} # strip leading '['
|
||||||
end=$(( start + clean_text_len - 1 ))
|
start=$(( (BAR_WIDTH - text_len) / 2 ))
|
||||||
colored_bar="${bar:0:start-1}${GREEN}${final_text}${RESET}${bar:end}"
|
end=$(( start + text_len ))
|
||||||
echo -e "\r$colored_bar$CLEAR_LINE"
|
|
||||||
# echo "Log: $LOG_FILE"
|
# Reconstruct bar with green text in place
|
||||||
|
green_bar="${final_bar:0:start+1}${GREEN}${final_text}${RESET}${final_bar:end+1}"
|
||||||
|
|
||||||
|
echo -e "\r$green_bar$CLEAR_LINE"
|
||||||
|
#echo "Log: $LOG_FILE"
|
||||||
}
|
}
|
||||||
|
|
||||||
run_deployment
|
run_deployment
|
||||||
|
|||||||
Reference in New Issue
Block a user