[PATCH 0/3] argument parsing additions
markwalters1009 at gmail.com
Sat Mar 10 03:23:15 PST 2012
On Sat, 10 Mar 2012 00:33:27 +0200, Jani Nikula <jani at nikula.org> wrote:
> Hi Mark -
> I'm not sure which is worse, criticizing or rewriting other people's
> patches. I already did the former, and now I'm doing the
> latter. Apologies for both. I didn't really mean to write these patches,
> but it turned out to be more fun writing a proper reply in C than in
> Patch 1 adds --arg=true and --arg=false support for booleans. It's not
> strictly required for the --entire-thread support in patch 3, which uses
> the extension of keyword arguments from patch 2, but it's for
> consistency across boolean arguments.
I like patch 1: I have an almost identical to my version (in the series
I just sent to the list
id:"1331377533-30262-1-git-send-email-markwalters1009 at gmail.com>
X-Mailer: git-send-email 184.108.40.206").
I am not sure about patch 2 and patch 3. Do you have a use case for
--option except when option is a boolean? Otherwise I think I prefer either my
approach (abusing a notmuch_bool_t) or just adding an option
NOTMUCH_OPT_BOOLEAN_AS_INT which does boolean parsing but returns an
int. I guess I am saying that I think allowing boolean options which can
sometimes default to true and sometimes to false is more useful than
allowing --option for arbitrary keywords (*).
What do you think?
(*) Indeed, I was thinking of the former as a possibility for the
exclude code, but I am erring towards just using keywords so I can allow
more options as you suggested.
> Please let me know what you think.
> Jani Nikula (3):
> command-line-arguments: allow true and false keywords for booleans
> command-line-arguments: support keyword arguments with default value
> cli: allow switching off entire thread mode in notmuch show json
> command-line-arguments.c | 45 +++++++++++++++++++++++++++++++++++++++------
> command-line-arguments.h | 1 +
> notmuch-show.c | 12 ++++++++++--
> 3 files changed, 50 insertions(+), 8 deletions(-)
More information about the notmuch