summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLyndon Brown <jnqnfe@gmail.com>2020-05-03 00:38:08 +0100
committerLyndon Brown <jnqnfe@gmail.com>2020-05-03 01:31:47 +0100
commit372a8fd91a9ec22c22250e4a0322432305b69a9f (patch)
tree14a31b77c18318508a0364740bd72e564511d5eb
parent82700d010b2b86e520cc3e71d2fd9ed11813f7d0 (diff)
downloadvyos-live-build-372a8fd91a9ec22c22250e4a0322432305b69a9f.tar.gz
vyos-live-build-372a8fd91a9ec22c22250e4a0322432305b69a9f.zip
args: restore a little tidying
lost in a reversion Gbp-Dch: Ignore
-rwxr-xr-xfunctions/arguments.sh17
1 files changed, 10 insertions, 7 deletions
diff --git a/functions/arguments.sh b/functions/arguments.sh
index a17cf3c1e..676925858 100755
--- a/functions/arguments.sh
+++ b/functions/arguments.sh
@@ -11,12 +11,15 @@
Arguments ()
{
+ local LONGOPTS="breakpoints,color,debug,force,help,no-color,quiet,usage,verbose,version"
+ local SHORTOPTS="huv"
+
local ARGUMENTS
local ERR=0
- ARGUMENTS="$(getopt --longoptions breakpoints,color,debug,force,help,no-color,quiet,usage,verbose,version --name=${PROGRAM} --options huv --shell sh -- "${@}")" || ERR=$?
+ ARGUMENTS="$(getopt --shell sh --name ${PROGRAM} --longoptions $LONGOPTS --options $SHORTOPTS -- "${@}")" || ERR=$?
if [ $ERR -eq 1 ]; then
- Echo_error "invalid arguments"
+ Echo_error "invalid argument(s)"
exit 1
elif [ $ERR -ne 0 ]; then
Echo_error "getopt failure"
@@ -25,11 +28,11 @@ Arguments ()
eval set -- "${ARGUMENTS}"
- while true
- do
- case "${1}" in
+ while true; do
+ local ARG="${1}"
+ case "${ARG}" in
--breakpoints|--color|--debug|--force|-h|--help|--no-color|--quiet|-u|--usage|--verbose|-v|--version)
- Handle_common_option "${1}"
+ Handle_common_option "${ARG}"
shift
;;
@@ -39,7 +42,7 @@ Arguments ()
;;
*)
- Echo_error "internal error %s" "${0}"
+ Echo_error "Internal error, unhandled option: %s" "${ARG}"
exit 1
;;
esac