diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2017-05-01 17:22:05 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2017-05-01 17:25:33 -0400 |
commit | a6ef2ffed4af47ff360bf0fc508aa24e83418f97 (patch) | |
tree | add4fe52338bb882a945e94465e26221d20b8fc2 /src/librefetch | |
parent | 326e045c879d7ee878dece305b6c5b43dc3a18db (diff) |
bugfix [2/2]: librefetch: Correctly fail when given bogus flags
Diffstat (limited to 'src/librefetch')
-rwxr-xr-x | src/librefetch/librefetch | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/librefetch/librefetch b/src/librefetch/librefetch index b0b538e..86986f3 100755 --- a/src/librefetch/librefetch +++ b/src/librefetch/librefetch @@ -250,9 +250,10 @@ parse_options() { long2+=() # Feed the options through getopt (sanitize them) - local shrt="$({ printf '%s\0' "${shrt1[@]}"; printf '%s:\0' "${shrt2[@]}"; } | sort -zu | xargs -0 printf '%s')" - local long="$({ printf '%s\0' "${long1[@]}"; printf '%s:\0' "${long2[@]}"; } | sort -zu | xargs -0 printf '%s,')" - local args="$(getopt -n "$cmd" -o "$shrt" -l "${long%,}" -- "$@")" || ret=$? + local shrt long args + shrt="$({ printf '%s\0' "${shrt1[@]}"; printf '%s:\0' "${shrt2[@]}"; } | sort -zu | xargs -0 printf '%s')" + long="$({ printf '%s\0' "${long1[@]}"; printf '%s:\0' "${long2[@]}"; } | sort -zu | xargs -0 printf '%s,')" + args="$(getopt -n "$cmd" -o "$shrt" -l "${long%,}" -- "$@")" || ret=$? eval set -- "$args" unset shrt long args |