Improving the command line UI of gpg

Werner Koch wk at gnupg.org
Tue Jul 24 08:51:29 CEST 2018


On Mon, 23 Jul 2018 20:22, doron.behar at gmail.com said:

> The problem resides in the fact that it accepts only `options` (starting
> with `--` or `-`. Shell completion engines are better built for commands

Right.  That is how Unix programs work.  Granted some tools have a
driver program which call different binaries depending on a keyword
(command) however they are rare and that is not how gpg works.  For
example to have something like

  gpg -v sign --detached FILE

the common thing would be for gpg to exec this

  gpg-sign -v --detached FILE

That would require a lot of extra binaries for no good reason.  It is
also not clear what should count as a global option (-v in the above
example) or as a command specific option (e.g. --detached).  The matrix
would be quiet complicated so that in the end both would not be
distinguished.

There is only one fact which distinguishes options from commands: Only
one command is possible and gpg will complain about.  However, it will
also warn about certain option combinations.

> that accept both options and commands. This makes it easier for the user
> (getting help either from the shell tab completion engine or the
> program's manual) to distinguish between commands and the optional

Why?

> Inspired by the (super comfortable IMO) command line user interface of
> `git`, I've had a vision for a new set of `gpg` subcommands and the
> corresponding arguments and options I think naming them so would be

We won't change the command line API of gpg it is a stable API for 20
years and you simply can't change that.  Considere what would happend if
you chnage the API of tar.

> source code, I've noticed GnuPG implements it's own command line
> arguments parsing. Maybe it'll be better to use a standard library like
> `argp.h`?

Nope.  argparse is much more flexible and includes a well designed help
interface as well as other goodies.  Actually it would even be possibe
to add some kind of configuration to allow optional specification of
commands without the option prefix (--) to mimic the behaviour of, say,
git.

> This obviously mean that it would make the next version of `gpg`
> incompatible with the older versions but I really think it's worth the

No way.


Salam-Shalom,

   Werner

-- 
#  Please read:  Daniel Ellsberg - The Doomsday Machine  #
Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 227 bytes
Desc: not available
URL: <https://lists.gnupg.org/pipermail/gnupg-devel/attachments/20180724/df03d8cb/attachment.sig>


More information about the Gnupg-devel mailing list