From: Austin Clements Date: Sun, 16 Dec 2012 03:17:24 +0000 (+1900) Subject: [PATCH 2/7] search: Support --format-version X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=f910d7a1c30949a31980ab6a8130ec3a1b0535ce;p=notmuch-archives.git [PATCH 2/7] search: Support --format-version --- diff --git a/fd/da17e4b375ab03f1266c1a073ac8fc256f2f17 b/fd/da17e4b375ab03f1266c1a073ac8fc256f2f17 new file mode 100644 index 000000000..5fa667900 --- /dev/null +++ b/fd/da17e4b375ab03f1266c1a073ac8fc256f2f17 @@ -0,0 +1,139 @@ +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 3FDAE431FBD + for ; Sat, 15 Dec 2012 19:17:41 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.7 +X-Spam-Level: +X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 + tests=[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 IM4BuGEOIYA1 for ; + Sat, 15 Dec 2012 19:17:40 -0800 (PST) +Received: from dmz-mailsec-scanner-1.mit.edu (DMZ-MAILSEC-SCANNER-1.MIT.EDU + [18.9.25.12]) + by olra.theworths.org (Postfix) with ESMTP id 86836431FB6 + for ; Sat, 15 Dec 2012 19:17:40 -0800 (PST) +X-AuditID: 1209190c-b7f886d000000936-19-50cd3d547475 +Received: from mailhub-auth-3.mit.edu ( [18.9.21.43]) + by dmz-mailsec-scanner-1.mit.edu (Symantec Messaging Gateway) with SMTP + id 98.59.02358.45D3DC05; Sat, 15 Dec 2012 22:17:40 -0500 (EST) +Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) + by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id qBG3HcIg020941; + Sat, 15 Dec 2012 22:17:38 -0500 +Received: from drake.dyndns.org + (209-6-116-242.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com + [209.6.116.242]) (authenticated bits=0) + (User authenticated as amdragon@ATHENA.MIT.EDU) + by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id qBG3Hauw012056 + (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); + Sat, 15 Dec 2012 22:17:38 -0500 (EST) +Received: from amthrax by drake.dyndns.org with local (Exim 4.77) + (envelope-from ) + id 1Tk4jP-0007c3-J5; Sat, 15 Dec 2012 22:17:35 -0500 +From: Austin Clements +To: notmuch@notmuchmail.org +Subject: [PATCH 2/7] search: Support --format-version +Date: Sat, 15 Dec 2012 22:17:24 -0500 +Message-Id: <1355627849-29099-3-git-send-email-amdragon@mit.edu> +X-Mailer: git-send-email 1.7.10.4 +In-Reply-To: <1355627849-29099-1-git-send-email-amdragon@mit.edu> +References: <1355627849-29099-1-git-send-email-amdragon@mit.edu> +X-Brightmail-Tracker: + H4sIAAAAAAAAA+NgFtrLIsWRmVeSWpSXmKPExsUixCmqrRtiezbAYO5pDovVc3ksrt+cyezA + 5LFz1l12j2erbjEHMEVx2aSk5mSWpRbp2yVwZczfe4yp4C5/ReOeT8wNjCd4uhg5OSQETCTe + XjrGAmGLSVy4t56ti5GLQ0hgH6PEpvl7GSGcDYwSu96fgXIeMUl8/HaaGcKZyyhxp/ssM0g/ + m4CGxLb9yxlBbBEBaYmdd2ezgtjMAo4Sn/cvYgOxhQVMJQ53LAWrZxFQlfix8ykTiM0r4CDR + vaeNDeIORYnuZxPAbE6g3s1bfoLZQkA1s48cZZvAyL+AkWEVo2xKbpVubmJmTnFqsm5xcmJe + XmqRrqFebmaJXmpK6SZGcChJ8uxgfHNQ6RCjAAejEg+vxdczAUKsiWXFlbmHGCU5mJREeXMs + zwYI8SXlp1RmJBZnxBeV5qQWH2KU4GBWEuFNmg9UzpuSWFmVWpQPk5LmYFES572cctNfSCA9 + sSQ1OzW1ILUIJivDwaEkwctsAzRUsCg1PbUiLTOnBCHNxMEJMpwHaLgySA1vcUFibnFmOkT+ + FKOilDjvU2ughABIIqM0D64XFuuvGMWBXhHm1QBp5wGmCbjuV0CDmYAGL7cBubq4JBEhJdXA + uPDVy+JTR3fPuGg0591zvwPPvSTLfL971NudStGL0fey+32o+2nyG2b9E5sbNh+xZbx3RcHi + 0YwJcsKCdw/Whil6/U3ZZLximeb1L5u+ec2tsX6ezPxjQYnOzrSay0E7mHvX7qwxqne4uWtJ + 341H8xm2fTkXZXVKe/3nvaw3bzceYDblvnj3p60SS3FGoqEWc1FxIgDB24vw0AIAAA== +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: Sun, 16 Dec 2012 03:17:41 -0000 + +--- + man/man1/notmuch-search.1 | 20 ++++++++++++++++++++ + notmuch-search.c | 3 +++ + 2 files changed, 23 insertions(+) + +diff --git a/man/man1/notmuch-search.1 b/man/man1/notmuch-search.1 +index 0aff348..5c771fa 100644 +--- a/man/man1/notmuch-search.1 ++++ b/man/man1/notmuch-search.1 +@@ -32,6 +32,15 @@ Presents the results in either JSON, S-Expressions or plain-text (default). + + .RS 4 + .TP 4 ++.BR \-\-format-version=N ++ ++Use the specified structured output format version. This is intended ++for programs that invoke \fBnotmuch\fR(1) internally. If omitted, the ++latest supported version will be used. ++.RE ++ ++.RS 4 ++.TP 4 + .B \-\-output=(summary|threads|messages|files|tags) + + .RS 4 +@@ -126,6 +135,17 @@ In this case all matching threads are returned but the "match count" + is the number of matching non-excluded messages in the thread. + .RE + ++.SH EXIT STATUS ++ ++This command supports the following special exit status codes ++ ++.TP ++.B 20 ++The requested format version is too old. ++.TP ++.B 21 ++The requested format version is too new. ++ + .SH SEE ALSO + + \fBnotmuch\fR(1), \fBnotmuch-config\fR(1), \fBnotmuch-count\fR(1), +diff --git a/notmuch-search.c b/notmuch-search.c +index 6218622..7704915 100644 +--- a/notmuch-search.c ++++ b/notmuch-search.c +@@ -318,6 +318,7 @@ notmuch_search_command (void *ctx, int argc, char *argv[]) + { "sexp", NOTMUCH_FORMAT_SEXP }, + { "text", NOTMUCH_FORMAT_TEXT }, + { 0, 0 } } }, ++ { NOTMUCH_OPT_INT, ¬much_format_version, "format-version", 0, 0 }, + { NOTMUCH_OPT_KEYWORD, &output, "output", 'o', + (notmuch_keyword_t []){ { "summary", OUTPUT_SUMMARY }, + { "threads", OUTPUT_THREADS }, +@@ -356,6 +357,8 @@ notmuch_search_command (void *ctx, int argc, char *argv[]) + INTERNAL_ERROR("no output format selected"); + } + ++ notmuch_exit_if_unsupported_format (); ++ + config = notmuch_config_open (ctx, NULL, NULL); + if (config == NULL) + return 1; +-- +1.7.10.4 +