Re: [PATCH 0/9] argument parsing fixes and improvements

Subject: Re: [PATCH 0/9] argument parsing fixes and improvements

Date: Mon, 25 Sep 2017 08:34:13 -0300

To: Jani Nikula, Daniel Kahn Gillmor

Cc: Notmuch Mail

From: David Bremner


Jani Nikula <jani@nikula.org> writes:

> On Wed, 20 Sep 2017, Daniel Kahn Gillmor <dkg@fifthhorseman.net> wrote:
>> right, about the defaults: as i'm sure you're aware, i'm trying to
>> introduce some boolean options whose default is "unset", meaning "do
>> whatever is set in the database config".  In particular, --try-decrypt
>> (for those subcommands which do indexing).  As you can see in
>> id:20170912230153.4175-8-dkg@fifthhorseman.net, i handle this by
>> declaring the internal variable as:
>>
>>    int try_decrypt = -1;
>>
>> And then i decide to act on it with:
>>
>>    if (try_decrypt == TRUE || try_decrypt = FALSE) {
>>       /* act on it… */
>>    }
>>
>> Otherwise, i invoke the internal functions and let them behave as the
>> database default does.

I think there is two different discussions one could be having here; one
about the UI, the other about the implimentation.

From the UI point of view, it seems like the best thing is to use any
configuration to set the default for a given boolean flag. Conceptually
this would look something like (semi-pseudo-code)

    try_decrypt = false;
    
    notmuch_database_get_config(notmuch, "try_decrypt", &try_decrypt);

    parse_arguments(argc, argv, ...)

We have 3 possibilities, with the latest specified one winning.

In the implmentation, we need to cope with the fact that the database
probably can't be opened until after the command line arguments are
processed.  There are various ways that might be achieved, but I think
we should agree on the UI we are trying to achieve first.
_______________________________________________
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch

Thread: