From: Mark Walters Date: Thu, 8 Mar 2012 22:15:42 +0000 (+0000) Subject: [PATCH 0/2] cli: Parsing. Add option NOTMUCH_OPT_INT_OR_BOOLEAN X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=1132587e9a8dca0333a0744dccb84c2224eaab20;p=notmuch-archives.git [PATCH 0/2] cli: Parsing. Add option NOTMUCH_OPT_INT_OR_BOOLEAN --- diff --git a/f6/a4660719dd9bd2fa0ae68886a0325f1dbbf9ff b/f6/a4660719dd9bd2fa0ae68886a0325f1dbbf9ff new file mode 100644 index 000000000..d1c41eaa1 --- /dev/null +++ b/f6/a4660719dd9bd2fa0ae68886a0325f1dbbf9ff @@ -0,0 +1,91 @@ +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 CD79A431FB6 + for ; Thu, 8 Mar 2012 14:15:55 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0.201 +X-Spam-Level: +X-Spam-Status: No, score=0.201 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, + 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 sd+QYoEgMUwE for ; + Thu, 8 Mar 2012 14:15:55 -0800 (PST) +Received: from mail-ww0-f45.google.com (mail-ww0-f45.google.com + [74.125.82.45]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client + certificate requested) by olra.theworths.org (Postfix) with ESMTPS id + 0BB44431FAE for ; Thu, 8 Mar 2012 14:15:54 -0800 + (PST) +Received: by wgbds10 with SMTP id ds10so878463wgb.2 + for ; Thu, 08 Mar 2012 14:15:52 -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=9o2iTOi2HIECD8EDfxe2wnqxt31Yq0Xkxg5fAZj7nyM=; + b=BnhRSoMOSXncumhurbuMbZQbsTSfZ3X0pqy4/GAjpgs3l3njcXImpaqwXUAbUHe8yg + AbHsA4CvOnJOJwrwcSmsXM76454EOkQB7iOL4ZYpQLNykNjEsWJrCWK9O6J69RS4s7cy + fumq8h4FKeJaS8mkMIzQ7tTH+WD3TbFKyzLyIfoNzjZOBLrPGHIFxDGmTnYLq9kfx4ms + CCW9EtiB2otm5CGvrHmaVAX9qUiRPS+jigG1RQTM0tDEesMy73VIpT7nBQNEU+b8OrgV + mITbGGhlg/AGosh//28CUvNoVHiY2F2C+oO5nmC/qbQAMmQjJTVw7SZfa9FkxNJ0sNs8 + woRA== +Received: by 10.180.106.9 with SMTP id gq9mr16490665wib.17.1331244952365; + Thu, 08 Mar 2012 14:15:52 -0800 (PST) +Received: from localhost (94-192-233-223.zone6.bethere.co.uk. + [94.192.233.223]) by mx.google.com with ESMTPS id + w10sm14906589wiy.3.2012.03.08.14.15.50 (version=TLSv1/SSLv3 cipher=OTHER); + Thu, 08 Mar 2012 14:15:51 -0800 (PST) +From: Mark Walters +To: notmuch@notmuchmail.org +Subject: [PATCH 0/2] cli: Parsing. Add option NOTMUCH_OPT_INT_OR_BOOLEAN +Date: Thu, 8 Mar 2012 22:15:42 +0000 +Message-Id: <1331244944-7960-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: Thu, 08 Mar 2012 22:15:55 -0000 + +The first patch adds a new command line parsing option +NOTMUCH_OPT_INT_OR_BOOLEAN for command line parsing which accepts +--verbose=3 and --verbose with the latter setting verbose to 1. It +also allows --verbose=0 so (with a little caller support) the user can +turn off boolean options. + +It also means that extra options can be added to the command line +programs in a backwards compatible manner (e.g. if --verbose already +exists we could add --verbose=2). + +The second patch uses this to make the --entire-thread option to +notmuch-show a NOTMUCH_OPT_INT_OR_BOOLEAN. In particular this allows +the caller to disable --entire-thread (with --entire-thread=0) when +format=json. + +Best wishes + +Mark + +Mark Walters (2): + cli: Parsing. Add option NOTMUCH_OPT_INT_OR_BOOLEAN + cli: make --entire-thread option notmuch-show.c INT_OR_BOOLEAN + + command-line-arguments.c | 29 +++++++++++++++++++++++++++-- + command-line-arguments.h | 3 +++ + notmuch-show.c | 10 ++++++++-- + 3 files changed, 38 insertions(+), 4 deletions(-) + +-- +1.7.9.1 +