Fix argument checking for functions with options.
[monkeysphere.git] / src / monkeysphere
index cb6c06c1907ac384a9450189bd2b82381f100994..2227b9156741ab25941c4296fac5b4e1f8c06027 100755 (executable)
@@ -90,6 +90,9 @@ gen_subkey(){
     done
 
     keyID="$1"
+    if [ -z "$keyID" ] ; then
+       failure "You must specify the key ID of your primary key."
+    fi
 
     gpgOut=$(gpg --quiet --fixed-list-mode --list-keys --with-colons \
        "$keyID" 2> /dev/null)
@@ -245,11 +248,7 @@ case $COMMAND in
        ;;
 
     'gen-subkey'|'g')
-       keyID="$1"
-       if [ -z "$keyID" ] ; then
-           failure "You must specify the key ID of your primary key."
-       fi
-       gen_subkey "$keyID"
+       gen_subkey "$@"
        ;;
 
     'help'|'h'|'?')