summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2014-05-15 22:06:45 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2014-05-15 22:06:45 -0400
commit7cdbee3ef93c1bef4b79310e4ef46cbde18c534f (patch)
tree624fba97092a11400c1cb231f4a6f472739e1403 /src
parent79588f1bcc6f8052964717cdb8fe4eb82dceb0df (diff)
librefetch: call usage() consistently
Diffstat (limited to 'src')
-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
;;