Simplify destroy options, no need to shift 1 on single options

This commit is contained in:
Jose
2020-02-20 10:41:41 -04:00
parent e26fe60fe4
commit 6b7b506c83
2 changed files with 21 additions and 20 deletions

View File

@@ -391,11 +391,11 @@ else
## handle single options
case "${1}" in
-T|--thick|thick)
shift 1
shift
THICK_JAIL="1"
;;
-V|--vnet|vnet)
shift 1
shift
VNET_JAIL="1"
;;
-*)

View File

@@ -152,29 +152,30 @@ help|-h|--help)
;;
esac
OPTION="${1}"
TARGET="${2}"
## reset this options
FORCE=""
## handle additional options
case "${OPTION}" in
-f|--force)
if [ $# -gt 2 ] || [ $# -lt 2 ]; then
case "${1}" in
-f|--force|force)
FORCE="1"
shift
;;
-*)
echo -e "${COLOR_RED}Unknown Option.${COLOR_RESET}"
usage
fi
FORCE="1"
;;
-*)
echo -e "${COLOR_RED}Unknown Option.${COLOR_RESET}"
usage
;;
*)
if [ $# -gt 1 ] || [ $# -lt 1 ]; then
usage
fi
TARGET="${1}"
;;
;;
*)
break
;;
esac
TARGET="${1}"
if [ $# -gt 1 ] || [ $# -lt 1 ]; then
usage
fi
## check what should we clean
case "${TARGET}" in
*-RELEASE|*-release|*-RC1|*-rc1|*-RC2|*-rc2)