From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id D9BF36DE0A6C for ; Mon, 25 Sep 2017 04:34:20 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[AWL=0.011, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id VlVHvOmhOU1e for ; Mon, 25 Sep 2017 04:34:20 -0700 (PDT) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by arlo.cworth.org (Postfix) with ESMTPS id DC79E6DE0352 for ; Mon, 25 Sep 2017 04:34:19 -0700 (PDT) Received: from remotemail by fethera.tethera.net with local (Exim 4.89) (envelope-from ) id 1dwRal-0000Bt-9O; Mon, 25 Sep 2017 07:30:27 -0400 Received: (nullmailer pid 24782 invoked by uid 1000); Mon, 25 Sep 2017 11:34:13 -0000 From: David Bremner To: Jani Nikula , Daniel Kahn Gillmor Cc: Notmuch Mail Subject: Re: [PATCH 0/9] argument parsing fixes and improvements In-Reply-To: <87k20st1yl.fsf@nikula.org> References: <87mv5qxt3d.fsf@fifthhorseman.net> <87o9q5wlnj.fsf@fifthhorseman.net> <87k20st1yl.fsf@nikula.org> Date: Mon, 25 Sep 2017 08:34:13 -0300 Message-ID: <87bmlz57wq.fsf@tethera.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Sep 2017 11:34:21 -0000 Jani Nikula writes: > On Wed, 20 Sep 2017, Daniel Kahn Gillmor 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 =3D -1; >> >> And then i decide to act on it with: >> >> if (try_decrypt =3D=3D TRUE || try_decrypt =3D FALSE) { >> /* act on it=E2=80=A6 */ >> } >> >> 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 =3D false; =20=20=20=20 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.