diff options
author | Raphaël Hertzog <hertzog@debian.org> | 2020-04-23 16:38:59 +0200 |
---|---|---|
committer | Raphaël Hertzog <hertzog@debian.org> | 2020-04-23 16:38:59 +0200 |
commit | 4c75f80e6763490d5bcb0e0a460b096a3292ae61 (patch) | |
tree | 9806aeebde92fc55b8435903badf3c3fcb7a5bd8 /functions | |
parent | b3bba232ac6e1feff9e506506247aa20cd7f467c (diff) | |
download | vyos-live-build-4c75f80e6763490d5bcb0e0a460b096a3292ae61.tar.gz vyos-live-build-4c75f80e6763490d5bcb0e0a460b096a3292ae61.zip |
Use descriptive parameter names for Usage()
Diffstat (limited to 'functions')
-rwxr-xr-x | functions/arguments.sh | 4 | ||||
-rwxr-xr-x | functions/usage.sh | 19 |
2 files changed, 16 insertions, 7 deletions
diff --git a/functions/arguments.sh b/functions/arguments.sh index 2c1266f78..b10a82532 100755 --- a/functions/arguments.sh +++ b/functions/arguments.sh @@ -127,7 +127,7 @@ Arguments () fi exit 0 elif [ "${IS_FRONTEND}" = "true" ]; then - Usage 0 + Usage --exit fi ;; @@ -137,7 +137,7 @@ Arguments () ;; -u|--usage) - Usage 0 + Usage --exit shift ;; diff --git a/functions/usage.sh b/functions/usage.sh index 388763895..4c4f585dc 100755 --- a/functions/usage.sh +++ b/functions/usage.sh @@ -11,10 +11,6 @@ Usage () { - if [ -z "${1}" ]; then - Echo_error "Usage() requires an exit code" - fi - echo "${PROGRAM_NAME} - ${DESCRIPTION}" printf "\nUsage:\n\n" @@ -29,5 +25,18 @@ Usage () echo echo "Try \"${PROGRAM} --help\" for more information." - exit $1 + case $1 in + --fail) + exit 1 + ;; + --exit) + exit 0 + ;; + "") + : + ;; + *) + Echo_error "Unexpected parameter to Usage(): $1" + ;; + esac } |