Re: [PATCH] cli: change argument parsing convention for subcommands

Subject: Re: [PATCH] cli: change argument parsing convention for subcommands

Date: Sat, 22 Oct 2011 19:08:50 +0200

To: david@tethera.net, notmuch@notmuchmail.org

Cc: David Bremner

From: Thomas Schwinge


Hi!

On Fri, 21 Oct 2011 09:19:17 -0300, david@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
part-000.sig (application/pgp-signature)

Thread: