From 41ad04d403de05abe54280d2a84aa51a603194e4 Mon Sep 17 00:00:00 2001 From: Justus Winter Date: Thu, 15 Dec 2016 15:32:51 +0100 Subject: [PATCH] g10: Rework the --quick-* interface. * g10/gpg.c (opts): Rename options. (main): Update errors. * doc/gpg.texi: Update accordingly. -- I decided not to keep the old versions as aliases in the documentation because the interface is a fairly recent addition. GnuPG-bug-id: 2700 Signed-off-by: Justus Winter --- doc/gpg.texi | 18 +++++++++--------- g10/gpg.c | 18 +++++++++++------- tests/openpgp/quick-key-manipulation.scm | 8 ++++---- 3 files changed, 24 insertions(+), 20 deletions(-) diff --git a/doc/gpg.texi b/doc/gpg.texi index 81588e119..ab0289d4d 100644 --- a/doc/gpg.texi +++ b/doc/gpg.texi @@ -618,8 +618,8 @@ This section explains the main commands for key management. @table @gnupgtabopt -@item --quick-gen-key @code{user-id} [@code{algo} [@code{usage} [@code{expire}]]] -@opindex quick-gen-key +@item --quick-generate-key @code{user-id} [@code{algo} [@code{usage} [@code{expire}]]] +@opindex quick-generate-key This is a simple command to generate a standard key with one user id. In contrast to @option{--generate-key} the key is generated directly without the need to answer a bunch of prompts. Unless the option @@ -636,7 +636,7 @@ created and no prompts are shown. To specify an expiration date but still create a primary and subkey use ``default'' or ``future-default'' for @code{algo} and ``default'' for @code{usage}. For a description of these optional arguments see the command -@code{--quick-addkey}. The @code{usage} accepts also the value +@code{--quick-add-key}. The @code{usage} accepts also the value ``cert'' which can be used to create a certification only primary key; the default is to a create certification and signing key. @@ -660,8 +660,8 @@ Directly set the expiration time of the primary key to @code{expire}. To remove the expiration time @code{0} can be used. -@item --quick-addkey @code{fpr} [@code{algo} [@code{usage} [@code{expire}]]] -@opindex quick-addkey +@item --quick-add-key @code{fpr} [@code{algo} [@code{usage} [@code{expire}]]] +@opindex quick-add-key Directly add a subkey to the key identified by the fingerprint @code{fpr}. Without the optional arguments an encryption subkey is added. If any of the arguments are given a more specific subkey is @@ -1074,16 +1074,16 @@ full flexibility of the "sign" subcommand from @option{--edit-key}. Its intended use is to help unattended key signing by utilizing a list of verified fingerprints. -@item --quick-adduid @var{user-id} @var{new-user-id} -@opindex quick-adduid +@item --quick-add-uid @var{user-id} @var{new-user-id} +@opindex quick-add-uid This command adds a new user id to an existing key. In contrast to the interactive sub-command @code{adduid} of @option{--edit-key} the @var{new-user-id} is added verbatim with only leading and trailing white space removed, it is expected to be UTF-8 encoded, and no checks on its form are applied. -@item --quick-revuid @var{user-id} @var{user-id-to-revoke} -@opindex quick-revuid +@item --quick-revoke-uid @var{user-id} @var{user-id-to-revoke} +@opindex quick-revoke-uid This command revokes a User ID on an existing key. It cannot be used to revoke the last User ID on key (some non-revoked User ID must remain), with revocation reason ``User ID is no longer valid''. If diff --git a/g10/gpg.c b/g10/gpg.c index f382a7ad0..e6807481b 100644 --- a/g10/gpg.c +++ b/g10/gpg.c @@ -447,13 +447,17 @@ static ARGPARSE_OPTS opts[] = { ARGPARSE_c (aKeygen, "generate-key", N_("generate a new key pair")), ARGPARSE_c (aKeygen, "gen-key", "@"), - ARGPARSE_c (aQuickKeygen, "quick-gen-key" , + ARGPARSE_c (aQuickKeygen, "quick-generate-key" , N_("quickly generate a new key pair")), - ARGPARSE_c (aQuickAddUid, "quick-adduid", + ARGPARSE_c (aQuickKeygen, "quick-gen-key", "@"), + ARGPARSE_c (aQuickAddUid, "quick-add-uid", N_("quickly add a new user-id")), + ARGPARSE_c (aQuickAddUid, "quick-adduid", "@"), + ARGPARSE_c (aQuickAddKey, "quick-add-key", "@"), ARGPARSE_c (aQuickAddKey, "quick-addkey", "@"), - ARGPARSE_c (aQuickRevUid, "quick-revuid", + ARGPARSE_c (aQuickRevUid, "quick-revoke-uid", N_("quickly revoke a user-id")), + ARGPARSE_c (aQuickRevUid, "quick-revuid", "@"), ARGPARSE_c (aQuickSetExpire, "quick-set-expire", N_("quickly set a new expiration date")), ARGPARSE_c (aFullKeygen, "full-generate-key" , @@ -4299,7 +4303,7 @@ main (int argc, char **argv) const char *x_algo, *x_usage, *x_expire; if (argc < 1 || argc > 4) - wrong_args("--quick-gen-key USER-ID [ALGO [USAGE [EXPIRE]]]"); + wrong_args("--quick-generate-key USER-ID [ALGO [USAGE [EXPIRE]]]"); username = make_username (fname); argv++, argc--; x_algo = ""; @@ -4364,7 +4368,7 @@ main (int argc, char **argv) const char *uid, *newuid; if (argc != 2) - wrong_args ("--quick-adduid USER-ID NEW-USER-ID"); + wrong_args ("--quick-add-uid USER-ID NEW-USER-ID"); uid = *argv++; argc--; newuid = *argv++; argc--; keyedit_quick_adduid (ctrl, uid, newuid); @@ -4376,7 +4380,7 @@ main (int argc, char **argv) const char *x_fpr, *x_algo, *x_usage, *x_expire; if (argc < 1 || argc > 4) - wrong_args ("--quick-addkey FINGERPRINT [ALGO [USAGE [EXPIRE]]]"); + wrong_args ("--quick-add-key FINGERPRINT [ALGO [USAGE [EXPIRE]]]"); x_fpr = *argv++; argc--; x_algo = ""; x_usage = ""; @@ -4402,7 +4406,7 @@ main (int argc, char **argv) const char *uid, *uidtorev; if (argc != 2) - wrong_args ("--quick-revuid USER-ID USER-ID-TO-REVOKE"); + wrong_args ("--quick-revoke-uid USER-ID USER-ID-TO-REVOKE"); uid = *argv++; argc--; uidtorev = *argv++; argc--; keyedit_quick_revuid (ctrl, uid, uidtorev); diff --git a/tests/openpgp/quick-key-manipulation.scm b/tests/openpgp/quick-key-manipulation.scm index 639fd6256..9b9c91914 100755 --- a/tests/openpgp/quick-key-manipulation.scm +++ b/tests/openpgp/quick-key-manipulation.scm @@ -52,7 +52,7 @@ (setenv "PINENTRY_USER_DATA" "test" #t) (info "Checking quick key generation...") -(call-check `(,@GPG --quick-gen-key ,alpha)) +(call-check `(,@GPG --quick-generate-key ,alpha)) (define keyinfo (gpg-with-colons `(-k ,(exact alpha)))) (define fpr (:fpr (assoc "fpr" keyinfo))) @@ -65,7 +65,7 @@ ;; Make sure the key capabilities don't change when we add a user id. ;; (See bug #2697.) (let ((pre (key-data (exact alpha))) - (result (call-check `(,@GPG --quick-adduid ,(exact alpha) ,bravo))) + (result (call-check `(,@GPG --quick-add-uid ,(exact alpha) ,bravo))) (post (key-data (exact alpha)))) (if (not (equal? pre post)) (begin @@ -83,7 +83,7 @@ (assert (= 2 (count-uids-of-secret-key bravo))) (info "Checking that we can revoke a user ID...") -(call-check `(,@GPG --quick-revuid ,(exact bravo) ,alpha)) +(call-check `(,@GPG --quick-revoke-uid ,(exact bravo) ,alpha)) (assert (= 1 (count-uids-of-secret-key bravo))) @@ -118,7 +118,7 @@ "Checking that we can add subkeys..." (lambda (args check) (set! count (+ 1 count)) - (call-check `(,@gpg --quick-addkey ,fpr ,@args)) + (call-check `(,@gpg --quick-add-key ,fpr ,@args)) (let ((subkeys (get-subkeys))) (assert (= count (length subkeys))) (if check (check (last subkeys)))))