[PATCH 0/9] argument parsing fixes and improvements

David Bremner david at tethera.net
Mon Sep 25 04:34:13 PDT 2017


Jani Nikula <jani at nikula.org> writes:

> On Wed, 20 Sep 2017, Daniel Kahn Gillmor <dkg at 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 at 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.


More information about the notmuch mailing list