mirror of
https://github.com/docker/docker-bench-security.git
synced 2025-01-19 00:32:34 +01:00
add option -m to disable colors in output
This commit is contained in:
parent
f81bc4d6d2
commit
482397e8d7
2 changed files with 33 additions and 2 deletions
|
@ -11,7 +11,6 @@
|
|||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Load dependencies
|
||||
. ./output_lib.sh
|
||||
. ./helper_lib.sh
|
||||
|
||||
# Setup the paths
|
||||
|
@ -38,6 +37,7 @@ usage () {
|
|||
usage: ${myname} [options]
|
||||
|
||||
-h optional Print this help message
|
||||
-m optional Disable colors in output
|
||||
-l PATH optional Log output in PATH
|
||||
EOF
|
||||
}
|
||||
|
@ -45,15 +45,20 @@ EOF
|
|||
# Get the flags
|
||||
# If you add an option here, please
|
||||
# remember to update usage() above.
|
||||
while getopts hl: args
|
||||
outputlib='output_lib.sh'
|
||||
|
||||
while getopts hml: args
|
||||
do
|
||||
case $args in
|
||||
h) usage; exit 0 ;;
|
||||
m) outputlib='textout_lib.sh' ;;
|
||||
l) logger="$OPTARG" ;;
|
||||
*) usage; exit 1 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
. ./${outputlib}
|
||||
|
||||
if [ -z "$logger" ]; then
|
||||
logger="${myname}.log"
|
||||
fi
|
||||
|
|
26
textout_lib.sh
Normal file
26
textout_lib.sh
Normal file
|
@ -0,0 +1,26 @@
|
|||
#!/bin/sh
|
||||
bldred=''
|
||||
bldgrn=''
|
||||
bldblu=''
|
||||
bldylw=''
|
||||
txtrst=''
|
||||
|
||||
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"
|
||||
}
|
Loading…
Reference in a new issue