[PATCH] cli: change argument parsing convention for subcommands

Thomas Schwinge thomas at schwinge.name
Sat Oct 22 10:08:50 PDT 2011


Hi!

On Fri, 21 Oct 2011 09:19:17 -0300, david at tethera.net wrote:
> previously we deleted the subcommand name from argv before passing to
> the subcommand. In this version, the deletion is done in the actual
> subcommands. Although this causes some duplication of code, it allows
> us to be more flexible about how we parse command line arguments in
> the subcommand, including possibly using off-the-shelf routines like
> getopt_long that expect the name of the command in argv[0].

Ack.  Like when the C library startup passes control to the main
function, where argv[0] is the invoked executable.

It seems that notmuch.c:notmuch_help_command also needs to be adapted?

notmuch-setup.c:notmuch_setup_command does not need to be adapted (and
hasn't been) for it doesn't look at its argv.  (It should bail out if
there are any arguments passed, but that's for another patch.)


Grüße,
 Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 489 bytes
Desc: not available
URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20111022/eba798d9/attachment.pgp>


More information about the notmuch mailing list