summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2011-07-20 13:26:44 -0400
committerDan McGee <dan@archlinux.org>2011-07-21 15:05:52 -0500
commit98073afe5527aa8a08c7119b61d0251250168e82 (patch)
tree34d65aecb48267e7006a0c210940f01470012f43 /scripts
parent768d3589a36c1a3c86cd91c4db401bc47737c47a (diff)
pacman-key: refactor post parse opt check into a case
This is a cleaner expression of the same information. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/pacman-key.sh.in23
1 files changed, 11 insertions, 12 deletions
diff --git a/scripts/pacman-key.sh.in b/scripts/pacman-key.sh.in
index 41fe8e6f..5cb5bd51 100644
--- a/scripts/pacman-key.sh.in
+++ b/scripts/pacman-key.sh.in
@@ -350,18 +350,17 @@ GPG_PACMAN="gpg --homedir ${PACMAN_KEYRING_DIR} --no-permission-warning"
# check only a single operation has been given
numopt=$(( ADD + DELETE + EDITKEY + EXPORT + FINGER + INIT + LIST + RECEIVE + RELOAD + UPDATEDB + VERIFY ))
-if (( ! numopt )); then
- error "$(gettext "No operations specified")"
- echo
- usage
- exit 1
-fi
-
-if (( numopt != 1 )); then
- error "$(gettext "Multiple operations specified")"
- printf "$(gettext "Please run %s with each operation separately\n")" "pacman-key"
- exit 1
-fi
+case $numopt in
+ 0)
+ error "$(gettext "no operation specified (use -h for help)")"
+ exit 1
+ ;;
+ [!1])
+ error "$(gettext "Multiple operations specified")"
+ printf "$(gettext "Please run %s with each operation separately\n")" "pacman-key"
+ exit 1
+ ;;
+esac
(( ! INIT )) && check_keyring