summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsrc/librefetch/librefetch7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/librefetch/librefetch b/src/librefetch/librefetch
index f41615f..b29598d 100755
--- a/src/librefetch/librefetch
+++ b/src/librefetch/librefetch
@@ -80,7 +80,10 @@ main() {
makepkg_opts=()
extra_opts=()
mode=download-create
- parse_options "$@"
+ if ! parse_options "$@"; then
+ usage >&2
+ exit 1
+ fi
# Mode: help ###########################################################
@@ -250,14 +253,12 @@ parse_options() {
checksums|srcbuild|makepkg) # don't take any extra arguments
if [[ ${#extra_opts[@]} != 0 ]]; then
print "%s: found extra non-flag arguments: %s" "$cmd" "${extra_opts[*]}" >&2
- usage >&2
return 1
fi
;;
*download*|*create*) # take 1 or 2 extra arguments
if [[ ${#extra_opts[@]} != 1 ]] && [[ ${#extra_opts[@]} != 2 ]]; then
print "%s: %d non-flag arguments found, expected 1 or 2: %s" "$cmd" ${#extra_opts[@]} >&2
- usage >&2
return 1
fi
;;