From ee77e6edcca7b3c47b0629a42144b7f3d1f6d002 Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Sun, 6 Sep 2020 13:35:43 +0200 Subject: [PATCH] Add debug function to script framework Signed-off-by: Knut Ahlers --- bin/script_framework.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bin/script_framework.sh b/bin/script_framework.sh index 4fd16f6..edf1391 100644 --- a/bin/script_framework.sh +++ b/bin/script_framework.sh @@ -3,11 +3,17 @@ COLOR_GREEN="\033[0;32m" COLOR_CYAN="\033[0;36m" COLOR_YELLOW="\033[0;33m" COLOR_PLAIN="\033[0m" +COLOR_PURPLE="\033[35m" function check_util() { which ${1} >/dev/null 2>&1 || fail "Missing ${1} util" } +function debug() { + [[ ${DEBUG:-false} != false ]] || return 0 + echo -e "${COLOR_PURPLE}$@${COLOR_PLAIN}" +} + function error() { echo -e "${COLOR_RED}$@${COLOR_PLAIN}" >&2 }