From 263f84fe801f1664150673158495f26c9ce5ab32 Mon Sep 17 00:00:00 2001 From: Lyndon Brown Date: Tue, 28 Apr 2020 19:10:47 +0100 Subject: clean: handle all common options support for options like `--debug` was missing. Gbp-Dch: Short --- scripts/build/clean | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/scripts/build/clean b/scripts/build/clean index 8851305b0..b28cdcd2d 100755 --- a/scripts/build/clean +++ b/scripts/build/clean @@ -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 - ;; - - -u|--usage) - Usage --exit + *) + IS_ACTION="false" ;; + esac + if [ "${IS_ACTION}" = "true" ]; then + ACTION_SELECTED="true" + continue + fi - -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)" -- cgit v1.2.3