--- /dev/null
+Return-Path: <jani@nikula.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id 5D5E0431FB6\r
+ for <notmuch@notmuchmail.org>; Thu, 8 Mar 2012 16:48:44 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+ tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id xw0mLNyia2CO for <notmuch@notmuchmail.org>;\r
+ Thu, 8 Mar 2012 16:48:43 -0800 (PST)\r
+Received: from mail-lpp01m010-f53.google.com (mail-lpp01m010-f53.google.com\r
+ [209.85.215.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id 7669D431FAE\r
+ for <notmuch@notmuchmail.org>; Thu, 8 Mar 2012 16:48:43 -0800 (PST)\r
+Received: by lahc1 with SMTP id c1so1165104lah.26\r
+ for <notmuch@notmuchmail.org>; Thu, 08 Mar 2012 16:48:40 -0800 (PST)\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+ d=google.com; s=20120113;\r
+ h=from:to:subject:in-reply-to:references:user-agent:date:message-id\r
+ :mime-version:content-type:x-gm-message-state;\r
+ bh=OEtb7ZIev9W+R+BNTQRVBycCS/8lS0CyXNP57l5Uxjs=;\r
+ b=CNlnSKrxRWGMnKLDMzIHUt5foUC/6tdVeRbTO1fUe9Nw/F61587WM6CIREH/QH0eVi\r
+ +gdiZoIYxEO5gnJ6JXDxv0/dyuvS80uQNhJhLh61WRHB0INySzP9QJoZD5uZU0IUo3uN\r
+ 4X36UasGThhV355RXri6AxKvmRXemgSZOA7awxe0A9VnNIOR49/Mun3z3rIF90e+OUcH\r
+ dRAHWHjsqsCUDuZRxGGLLr0zeHTqe3AOopgJR8Lq8PZJNagAj8gopgsfaY/hzO3Nbagc\r
+ O2n4ZIGLrotsRbLeN3RUhjvzC4Fi0Bcrk3VTUp/DufMNXJPQdgBxXkrRPJhRs2Zo6e0w\r
+ NwqQ==\r
+Received: by 10.112.47.161 with SMTP id e1mr100575lbn.42.1331254120312;\r
+ Thu, 08 Mar 2012 16:48:40 -0800 (PST)\r
+Received: from localhost (dsl-hkibrasgw4-fe50f800-253.dhcp.inet.fi.\r
+ [84.248.80.253])\r
+ by mx.google.com with ESMTPS id p9sm4315364lbw.10.2012.03.08.16.48.37\r
+ (version=SSLv3 cipher=OTHER); Thu, 08 Mar 2012 16:48:38 -0800 (PST)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: Mark Walters <markwalters1009@gmail.com>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH 0/2] cli: Parsing. Add option NOTMUCH_OPT_INT_OR_BOOLEAN\r
+In-Reply-To: <1331244944-7960-1-git-send-email-markwalters1009@gmail.com>\r
+References: <1331244944-7960-1-git-send-email-markwalters1009@gmail.com>\r
+User-Agent: Notmuch/0.11.1+295~g780f284 (http://notmuchmail.org) Emacs/23.3.1\r
+ (i686-pc-linux-gnu)\r
+Date: Fri, 09 Mar 2012 02:48:35 +0200\r
+Message-ID: <87lina8uqk.fsf@nikula.org>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+X-Gm-Message-State:\r
+ ALoCoQnhkiMV0N+Y0j0cvS0egUJSXr7GVgJJMMm2k3nvQ9V4ll4z4NHDrVfFdauxSCCIEG5eSPIS\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Fri, 09 Mar 2012 00:48:44 -0000\r
+\r
+On Thu, 8 Mar 2012 22:15:42 +0000, Mark Walters <markwalters1009@gmail.com> wrote:\r
+> The first patch adds a new command line parsing option\r
+> NOTMUCH_OPT_INT_OR_BOOLEAN for command line parsing which accepts\r
+> --verbose=3 and --verbose with the latter setting verbose to 1. It\r
+> also allows --verbose=0 so (with a little caller support) the user can\r
+> turn off boolean options.\r
+> \r
+> It also means that extra options can be added to the command line\r
+> programs in a backwards compatible manner (e.g. if --verbose already\r
+> exists we could add --verbose=2).\r
+> \r
+> The second patch uses this to make the --entire-thread option to\r
+> notmuch-show a NOTMUCH_OPT_INT_OR_BOOLEAN. In particular this allows\r
+> the caller to disable --entire-thread (with --entire-thread=0) when\r
+> format=json.\r
+\r
+I'm afraid I find both of the patches a bit hacky. The first because\r
+it's more about optional arguments to options than int-or-bool. The\r
+second because it's more about detecting whether the user has provided\r
+an option than int-or-bool.\r
+\r
+For booleans, I think the notmuch style would be to allow --foo=true and\r
+--foo=false in addition to just --foo (which implies true) so you could\r
+also disable booleans. I think this would be fairly simple to implement,\r
+and would require no changes to option parser users.\r
+\r
+With --entire-thread the bigger problem is detecting whether the option\r
+was specified by the user or not. It would be great if the option parser\r
+could provide this information, but it might take a while to get\r
+there... In the mean time, I think I would rather see a well commented\r
+local hack here initializing the notmuch_bool_t params.entire_thread to\r
+-1, and changing it to TRUE or FALSE if not already done so by\r
+parse_arguments().\r
+\r
+\r
+BR,\r
+Jani.\r
+\r
+\r
+> \r
+> Best wishes\r
+> \r
+> Mark\r
+> \r
+> Mark Walters (2):\r
+> cli: Parsing. Add option NOTMUCH_OPT_INT_OR_BOOLEAN\r
+> cli: make --entire-thread option notmuch-show.c INT_OR_BOOLEAN\r
+> \r
+> command-line-arguments.c | 29 +++++++++++++++++++++++++++--\r
+> command-line-arguments.h | 3 +++\r
+> notmuch-show.c | 10 ++++++++--\r
+> 3 files changed, 38 insertions(+), 4 deletions(-)\r
+> \r
+> -- \r
+> 1.7.9.1\r
+> \r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r