1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

Make build scripts color brighter (#2803)

* Make build scripts color brighter

* better colors, draw deps and ninja generator options

* Add color spinner for configure and install make changed to cmake --build and cmake --install

* Clean more builds log garbage
This commit is contained in:
Leonid Fedorov
2023-04-11 03:35:05 +03:00
committed by GitHub
parent c38d98a510
commit 105cf2da22
2 changed files with 132 additions and 20 deletions

View File

@ -1,10 +1,11 @@
color_normal=$(tput sgr0)
color_bold=$(tput bold)
color_red="$color_bold$(tput setaf 1)"
color_green=$(tput setaf 2)
color_green="$color_bold$(tput setaf 2)"
color_fawn=$(tput setaf 3); color_beige="$color_fawn"
color_yellow="$color_bold$color_fawn"
color_darkblue=$(tput setaf 4)
color_blue="$color_bold$color_darkblue"
color_purple=$(tput setaf 5); color_magenta="$color_purple"
color_pink="$color_bold$color_purple"
@ -14,21 +15,89 @@ color_gray=$(tput setaf 7)
color_darkgray="$color_bold"$(tput setaf 0)
color_white="$color_bold$color_gray"
if [[ $(tput colors) == '256' ]]; then
color_red=$(tput setaf 196)
color_yellow=$(tput setaf 228)
color_cyan=$(tput setaf 87)
color_green=$(tput setaf 156)
color_darkgray=$(tput setaf 59)
fi
message()
{
echo $color_cyan -- $@$color_normal
echo $color_cyan $@$color_normal
}
warn()
{
echo $color_yellow -- $@$color_normal
echo $color_yellow $@$color_normal
}
error()
{
echo $color_red -- $@$color_normal
echo $color_red $@$color_normal
}
message_split()
{
echo $color_darkgray ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ $color_normal
}
message_splitted()
{
message_split
echo $color_green$@$color_normal
message_split
}
colorify_array()
{
PROMT=""
for a in "$@"
do
i=$((((i+1) % (123-106)) + 106))
if [[ $(tput colors) == '256' ]]; then
PROMT="$PROMT $(tput setaf $i)$a$color_normal"
else
PROMT="$PROMT $a"
fi
done
echo $PROMT
}
newline_array()
{
PROMT=""
for a in "$@"
do
PROMT="$PROMT$a\n"
done
echo -e $PROMT
}
function spinner
{
freq=${1:-10}
points=(⣾ ⣽ ⣻ ⢿ ⡿ ⣟ ⣯ ⣷)
colored_points=($(colorify_array ${points[@]}))
len=${#points[@]}
point_num=0
line_num=0
while read data; do
line_num=$((line_num+1))
if [[ $((line_num % freq)) = 0 ]]; then
point_num=$(((point_num + 1) % len ))
echo -ne "\r${colored_points[point_num]}"
fi
done;
echo
}
detect_distro()
{
if [ -f /etc/os-release ]; then