Add debug function to script framework
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
9a981fec37
commit
ee77e6edcc
1 changed files with 6 additions and 0 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue