Suggest possible choices instead to error out on a typo
Open, WishlistPublic

Description

with the debian 2.2.3-1 package, i'm seeing:

0 dkg@alice:/tmp/cdtemp.KhERQL$ gpg --quick-gen-key 'Test <test@example.net>' futuredefault
gpg: Key generation failed: Unknown elliptic curve
2 dkg@alice:/tmp/cdtemp.KhERQL$
dkg created this task.Dec 29 2017, 9:54 PM

Any fix for this should be included in the test suite to avoid a regression :)

werner closed this task as Invalid.Dec 30 2017, 1:42 PM
werner added a subscriber: werner.

It is

future-default

and not

futuredefault

All unknown strings are taken as EC names and thus the error message.

dkg reopened this task as Open.Dec 31 2017, 2:02 AM

When i read the manpage, nroff-formatted against an 80-column terminal, it says, literally:

If  algo or usage are given, only the primary key is created and
 no prompts are shown.  To specify an expiration date  but  still
 create  a  primary  and  subkey  use  ``default''  or  ``future-
 default'' for algo and ``default'' for usage.  For a description
 of  these  optional  arguments  see the command --quick-add-key.
 The usage accepts also the value ``cert'' which can be  used  to
 create  a  certification  only  primary key; the default is to a

so at least this hyphen should be made a non-breaking hyphen in the documentation.

another reasonable resolution would be if futuredefault were an alias for future-default.

finally, a friendly approach would be to use Levenshtein distance against known labels when an unmatched name appears.

This kind of user-friendliness is not unprecedented. for example:

0 dkg@alice:~$ git sendemail origin/master
git: 'sendemail' is not a git command. See 'git --help'.

The most similar command is
	send-email
1 dkg@alice:~$
werner added a comment.Jan 1 2018, 3:12 PM

I added "futuredefault" as an alias and also made the matching case-insensitiv. Changing the rendering is not easy because using a non-breaking hyphen in @code{} would not look very nice.

I considered to print a hint like in git but that would require to write and test quite some new code because git is GPLv2only. Any hints where I can snatch some GPLv2+ code?

werner triaged this task as Wishlist priority.Jan 1 2018, 5:36 PM
werner renamed this task from "futuredefault" ( from --quick-gen-key) yields "Unknown elliptic curve" to Suggest possible choices instead to error out on a typo.Apr 13 2018, 12:35 PM
werner edited projects, added gnupg; removed gnupg (gpg22).Feb 11 2019, 1:50 PM