docker-bench-security/output_lib.sh
lusitania e0da108094 Make colours, escape sequences optional
Coloured output is tedious to parse, even unnecessary where the report
backend is not a terminal.

Signed-off-by: lusitania <lusitania@users.noreply.github.com>
2015-10-09 11:01:43 +02:00

38 lines
650 B
Bash

#!/bin/sh
getopts n opts
case "$opts" in
n)
bldred=
bldgrn=
bldblu=
bldylw=
txtrst=
;;
*)
bldred='\033[1;31m'
bldgrn='\033[1;32m'
bldblu='\033[1;34m'
bldylw='\033[1;33m' # Yellow
txtrst='\033[0m'
;;
esac
logit () {
printf "%b\n" "$1" | tee -a "$logger"
}
info () {
printf "%b\n" "${bldblu}[INFO]${txtrst} $1" | tee -a "$logger"
}
pass () {
printf "%b\n" "${bldgrn}[PASS]${txtrst} $1" | tee -a "$logger"
}
warn () {
printf "%b\n" "${bldred}[WARN]${txtrst} $1" | tee -a "$logger"
}
yell () {
printf "%b\n" "${bldylw}$1${txtrst}\n"
}