From 0f4014797cf94982e801d06d23befac580f7995c Mon Sep 17 00:00:00 2001 From: Mark Walters Date: Sat, 10 Mar 2012 11:05:31 +0000 Subject: [PATCH] [PATCH v2 0/2] cli: Allow true/false parameter for boolean --- 5c/ad0dd77fd874b48b66de167cd88f01b2306eb7 | 87 +++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 5c/ad0dd77fd874b48b66de167cd88f01b2306eb7 diff --git a/5c/ad0dd77fd874b48b66de167cd88f01b2306eb7 b/5c/ad0dd77fd874b48b66de167cd88f01b2306eb7 new file mode 100644 index 000000000..ee309c602 --- /dev/null +++ b/5c/ad0dd77fd874b48b66de167cd88f01b2306eb7 @@ -0,0 +1,87 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 684CE431FBC + for ; Sat, 10 Mar 2012 03:05:42 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 2.7 +X-Spam-Level: ** +X-Spam-Status: No, score=2.7 tagged_above=-999 required=5 + tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, + FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001, + FREEMAIL_REPLY=2.499, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id q4uGLC0YAS-Z for ; + Sat, 10 Mar 2012 03:05:42 -0800 (PST) +Received: from mail-wi0-f173.google.com (mail-wi0-f173.google.com + [209.85.212.173]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id B4F7D431FAE + for ; Sat, 10 Mar 2012 03:05:41 -0800 (PST) +Received: by wibhq7 with SMTP id hq7so1254475wib.2 + for ; Sat, 10 Mar 2012 03:05:39 -0800 (PST) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; + h=from:to:cc:subject:date:message-id:x-mailer; + bh=vymqPDPaoLuJLVv6jQsK0eiId4rGrGAv16CUwaQ9YTY=; + b=yIuCIw13uKPUYRrdpmWa8dCHSfd+rG1eqs6zQUCZXtFPRs3kQg0D+Cec84S8StUHeU + cx0ZxGoYyeGLQYiIonhznOrM8oSFPt1Ip3+yJPz79bqHDAEsrNYEov6dhJIgUpAwMoYE + NmBPojz83XrkpfYPZbKts7xueIa1CNLL5Rowxeg2arnDAiVsqOb6mnt8mcj3NjIAuv1A + P2vYQQ82GR761jpnRNtVaNNJUK2eO+4sxaPmqk49ToWLzPiKf+rOUunAdKhXkWGfYFVj + rCTbTFS0C2uMcIwCBzrCMHbZ+xK7K8ZRhc6KmLAqVa0T+06M7Nnh9v6sHR91MBOaPQAU + FVwQ== +Received: by 10.180.95.34 with SMTP id dh2mr12287588wib.15.1331377538984; + Sat, 10 Mar 2012 03:05:38 -0800 (PST) +Received: from localhost (94-192-233-223.zone6.bethere.co.uk. + [94.192.233.223]) by mx.google.com with ESMTPS id + be4sm24539449wib.8.2012.03.10.03.05.36 (version=TLSv1/SSLv3 cipher=OTHER); + Sat, 10 Mar 2012 03:05:37 -0800 (PST) +From: Mark Walters +To: notmuch@notmuchmail.org +Subject: [PATCH v2 0/2] cli: Allow true/false parameter for boolean +Date: Sat, 10 Mar 2012 11:05:31 +0000 +Message-Id: <1331377533-30262-1-git-send-email-markwalters1009@gmail.com> +X-Mailer: git-send-email 1.7.9.1 +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +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: Sat, 10 Mar 2012 11:05:42 -0000 + +Hi + +Here is a second version of a patch to allow parameters to boolean +options on the command line. This version allows parameters +(=true|false). My first version is at +id:"1331244944-7960-1-git-send-email-markwalters1009@gmail.com". Jani +posted an alternative version there. Jani's version and this one are +quite similar: the key difference is that this version abuses a +notmuch_bool_t by setting it to -1 (to indicate that the parser has +not set this option). This makes the code simpler but is definitely an +abuse. I will discuss this further in replies to Jani's series. + +Best wishes + +Mark + +Mark Walters (2): + cli: Parsing. Allow true/false parameter for boolean options. + cli: make --entire-thread=false work for format=json. + + command-line-arguments.c | 34 ++++++++++++++++++++++++++-------- + notmuch-show.c | 15 +++++++++++++-- + 2 files changed, 39 insertions(+), 10 deletions(-) + +-- +1.7.9.1 + -- 2.26.2