Surprising command line options handling

Werner Koch wk at gnupg.org
Tue Feb 24 09:34:09 CET 2015


On Tue, 24 Feb 2015 00:59, daniele at grinta.net said:

> However, the ordering is not really enforced: this

Right.  Options and commands are actuallay interchangeable but that is
an undocumented features.  In fact the only difference between a command
and an option is that tehre may only be one command but many options.
And the error message for a command is slightly different.

> I find it surprising that unrecognized tokens are simply ignored.
> Wouldn't it be preferable to error out, at least on unrecognized options?

GnuPG does not follow the common GNU model of interchangeable options
and args.  It is modeled like a classic Unix tool.  Using the special
option '--' indicates that everything what follows are args and using
this is suggested to avoid args beeing interpreted as options.

No, we can't error out on an arg which looks like an option because that
may actually be a valid argument.


Salam-Shalom,

   Werner

-- 
Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.




More information about the Gnupg-users mailing list