color tweaks

This commit is contained in:
Christian Winther 2024-01-17 15:59:58 +00:00
parent 82ab545f1a
commit 921f34d42e

View file

@ -10,6 +10,7 @@ set -e -o errexit -o nounset -o pipefail
declare -g error_message_color="\033[1;31m" declare -g error_message_color="\033[1;31m"
declare -g warn_message_color="\033[1;34m" declare -g warn_message_color="\033[1;34m"
declare -g notice_message_color="\033[1;34m" declare -g notice_message_color="\033[1;34m"
declare -g success_message_color="\033[1;32m"
declare -g color_clear="\033[1;0m" declare -g color_clear="\033[1;0m"
# Current and previous log prefix # Current and previous log prefix
@ -80,7 +81,7 @@ function run-command-as() {
target_user=${1} target_user=${1}
shift shift
log-info-stderr "👷 Running [${*}] as [${target_user}]" log-info-stderr "${notice_message_color}👷 Running [${*}] as [${target_user}]${color_clear}"
if [[ ${target_user} != "root" ]]; then if [[ ${target_user} != "root" ]]; then
stream-prefix-command-output su --preserve-environment "${target_user}" --shell /bin/bash --command "${*}" stream-prefix-command-output su --preserve-environment "${target_user}" --shell /bin/bash --command "${*}"
@ -91,11 +92,11 @@ function run-command-as() {
exit_code=$? exit_code=$?
if [[ $exit_code != 0 ]]; then if [[ $exit_code != 0 ]]; then
log-error "❌ Error!" log-error "${error_message_color}❌ Error!${color_clear}"
return "$exit_code" return "$exit_code"
fi fi
log-info-stderr "✅ OK!" log-info-stderr "${success_message_color}✅ OK!${color_clear}"
return "$exit_code" return "$exit_code"
} }