summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllan McRae <allan@archlinux.org>2010-11-25 13:20:06 +1000
committerDan McGee <dan@archlinux.org>2011-03-23 01:59:42 -0500
commit5a89a12aa012ceb3ee03ad4ced8d8bde44176e6f (patch)
treec100a07527a970ad7be198954a467058c7e55e48
parent422925a65efb2abcc6a3cac34f09de2dbf8664be (diff)
pacman-key: improve usage output
Make the usage output display nicely on 80 character width terminals. Also fix parsing of "-h" and "-v" options and avoid root check when run with no commands. Signed-off-by: Allan McRae <allan@archlinux.org>
-rw-r--r--scripts/pacman-key.sh.in38
1 files changed, 21 insertions, 17 deletions
diff --git a/scripts/pacman-key.sh.in b/scripts/pacman-key.sh.in
index 0f558a9c..ccaf4b2a 100644
--- a/scripts/pacman-key.sh.in
+++ b/scripts/pacman-key.sh.in
@@ -61,20 +61,24 @@ usage() {
printf "$(gettext " Default is set in %s")\n" "@sysconfdir@/pacman.conf"
echo
echo "$(gettext "The available commands are:")"
- echo "$(gettext " pacman-key -a | --add [<file>] ... - add the key contained ")"
- echo "$(gettext " in <file> (empty for stdin)")"
- echo "$(gettext " pacman-key -d | --del <keyid> ... - remove the key <keyid>")"
- echo "$(gettext " pacman-key -e | --export <keyid> ... - output the key <keyid>")"
- echo "$(gettext " pacman-key -r | --receive <keyserver> <keyid> ... - fetch the keyids from")"
- echo "$(gettext " the specified keyserver URL")"
- echo "$(gettext " pacman-key -t | --trust <keyid> ... - set the trust level of the given key")"
- echo "$(gettext " pacman-key -u | --updatedb - update the trustdb of pacman")"
- echo "$(gettext " pacman-key --reload - reloads the keys from the keyring package")"
- echo "$(gettext " pacman-key -l | --list - list keys")"
- echo "$(gettext " pacman-key -f | --finger [<keyid]> ... - list fingerprint for specified keyids (or for all, if none is specified)")"
- echo "$(gettext " pacman-key --adv <params> - use pacman's keyring as target for advanced commands")"
- echo "$(gettext " pacman-key -h | --help - displays this message")"
- echo "$(gettext " pacman-key -v | --version - displays the current version")"
+ echo "$(gettext " -a | --add [<file>] ... - add the key contained in <file>")"
+ echo "$(gettext " (empty for stdin)")"
+ echo "$(gettext " -d | --del <keyid> ... - remove the key <keyid>")"
+ echo "$(gettext " -e | --export <keyid> ... - output the key <keyid>")"
+ echo "$(gettext " -f | --finger [<keyid>] ... - list fingerprint for specified keyids")"
+ echo "$(gettext " (or for all, if no key is specified)")"
+ echo "$(gettext " -h | --help - displays this message")"
+ echo "$(gettext " -l | --list - list keys")"
+ echo "$(gettext " -r | --receive <keyserver> <keyid> ... - fetch the keyids from the specified")"
+ echo "$(gettext " keyserver URL")"
+ echo "$(gettext " -t | --trust <keyid> ... - set the trust level of the given key")"
+ echo "$(gettext " -u | --updatedb - update the trustdb of pacman")"
+ echo "$(gettext " -v | --version - displays the current version")"
+ echo "$(gettext " --adv <params> - use pacman's keyring as target for")"
+ echo "$(gettext " advanced gpg commands")"
+ echo "$(gettext " --reload - reloads the keys supplied by your")"
+ printf "$(gettext " distribution in %s")"'@prefix@/share/pacman'
+ echo
}
version() {
@@ -214,7 +218,7 @@ if ! type gettext &>/dev/null; then
}
fi
-if [[ $1 != "--version" && $1 != "-v" && $1 != "--help" && $1 != "-h" ]]; then
+if [[ $1 != "--version" && $1 != "-v" && $1 != "--help" && $1 != "-h" && $1 != "" ]]; then
if type -p gpg >/dev/null 2>&1 = 1; then
error "$(gettext "gnupg does not seem to be installed.")"
msg2 "$(gettext "pacman-key requires gnupg for most operations.")"
@@ -317,10 +321,10 @@ case "${command}" in
${GPG_PACMAN} "$@" || ret=$?
exit $ret
;;
- --help)
+ -h | --help)
usage
;;
- --version)
+ -v | --version)
version
exit 0
;;