summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main.sh16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/main.sh b/src/main.sh
index f50cad4..549e45e 100644
--- a/src/main.sh
+++ b/src/main.sh
@@ -47,9 +47,14 @@ _get_options()
unset OPTARG
while getopts "${OPTSTRING}" opt; do
- if [ "x${opt}" != 'x?' ]; then
- eval "opt_${opt}=\"\${OPTARG:-true}\""
- fi
+ case "${opt}" in
+ '?')
+ return 1
+ ;;
+ *)
+ eval "opt_${opt}=\"\${OPTARG:-true}\""
+ ;;
+ esac
unset OPTARG
done
@@ -70,7 +75,10 @@ main()
load_locale || return 1
- _get_options "${@}"
+ if ! _get_options "${@}"; then
+ cmd_help_main 1>&2
+ return 1
+ fi
shift $((${OPTIND} - 1))
base_dir="${opt_b:-.}"