clean: handle all common options

support for options like `--debug` was missing.

Gbp-Dch: Short
This commit is contained in:
Lyndon Brown 2020-04-28 19:10:47 +01:00
parent fca1283147
commit 263f84fe80
1 changed files with 17 additions and 13 deletions

View File

@ -23,7 +23,7 @@ fi
# Setting static variables
DESCRIPTION="Clean up system build directories"
USAGE="${PROGRAM} [--all] [--cache] [--chroot] [--binary] [--purge] [--remove] [--stage] [--source]"
USAGE="${PROGRAM} [--all] [--cache] [--chroot] [--binary] [--purge] [--remove] [--stage] [--source] [COMMON_OPTIONS]"
# Reading, preparing and validating config
Read_conffiles $(Common_conffiles)
@ -39,11 +39,10 @@ fi
Remove_lockfile
if [ $# -eq 0 ]; then
set -- "--all"
fi
ACTION_SELECTED="false"
for ARGUMENT in "${@}"; do
IS_ACTION="true"
case "${ARGUMENT}" in
--all)
RM_ALL="true"
@ -77,17 +76,19 @@ for ARGUMENT in "${@}"; do
RM_SOURCE="true"
;;
-h|--help)
Man
*)
IS_ACTION="false"
;;
esac
if [ "${IS_ACTION}" = "true" ]; then
ACTION_SELECTED="true"
continue
fi
-u|--usage)
Usage --exit
;;
-v|--version)
echo "${VERSION}"
exit 0
case "${ARGUMENT}" in
--breakpoints|--color|--debug|--force|-h|--help|--no-color|--quiet|-u|--usage|--verbose|-v|--version)
Handle_common_option "${ARGUMENT}"
shift
;;
*)
@ -96,6 +97,9 @@ for ARGUMENT in "${@}"; do
;;
esac
done
if [ "${ACTION_SELECTED}" = "false" ]; then
RM_ALL="true"
fi
STAGEFILES_DIR="$(Stagefiles_dir)"