[pacman-dev] [PATCH 3/4] pacman-key.sh.in: fail with indication of the wrong switch

ivan.kanak at gmail.com ivan.kanak at gmail.com
Tue Apr 19 16:19:20 EDT 2011


From: Ivan Kanakarakis <ivan.kanak at gmail.com>

now if the command is unkown we get a message like:
$ ./scripts/pacman-key --foo
Uknown command: --foo
<..usage..>

---
 scripts/pacman-key.sh.in |   25 ++++++++++++++++---------
 1 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/scripts/pacman-key.sh.in b/scripts/pacman-key.sh.in
index 5323f68..7261c89 100644
--- a/scripts/pacman-key.sh.in
+++ b/scripts/pacman-key.sh.in
@@ -344,16 +344,23 @@ case "${command}" in
         exit $ret
         ;;
     -h|--help)
-        usage; 
-        exit 0 
+        usage
+        exit 0
         ;;
     -V|--version)
-        version; 
-        exit 0 
+        version
+        exit 0
+        ;;
+    # Parameters already handled
+    --config)
+        shift
+        ;;
+    --gpgdir)
+        shift
+        ;;
+    *)
+        error "$(gettext "Unknown command: $command")"
+        usage
+        exit 1
         ;;
-        # Parameters already handled
-        --config) shift ;;
-    --gpgdir) shift ;;
-*)
-    usage; exit 1 ;;
 esac
-- 
1.7.4.4



More information about the pacman-dev mailing list