mirror of
https://github.com/docker/docker-bench-security.git
synced 2025-01-31 06:22:32 +01:00
Merge pull request #78 from jumanjiman/usage
improve CLI option handling
This commit is contained in:
commit
a010128ed2
1 changed files with 10 additions and 7 deletions
|
@ -35,11 +35,12 @@ if [ $? -ne 0 ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
usage () {
|
usage () {
|
||||||
printf "
|
cat <<EOF
|
||||||
usage: %s [options]
|
usage: ${myname} [options]
|
||||||
|
|
||||||
-h optional Print this help message\n" "$myname"
|
-h optional Print this help message
|
||||||
exit 1
|
-l PATH optional Log output in PATH
|
||||||
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
yell "# ------------------------------------------------------------------------------
|
yell "# ------------------------------------------------------------------------------
|
||||||
|
@ -62,12 +63,14 @@ if [ "x$ID" != "x0" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Get the flags
|
# Get the flags
|
||||||
while getopts :hlfi: args
|
# If you add an option here, please
|
||||||
|
# remember to update usage() above.
|
||||||
|
while getopts hl: args
|
||||||
do
|
do
|
||||||
case $args in
|
case $args in
|
||||||
h) usage ;;
|
h) usage; exit 0 ;;
|
||||||
l) logger="$OPTARG" ;;
|
l) logger="$OPTARG" ;;
|
||||||
*) usage ;;
|
*) usage; exit 1 ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue