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 55EA9431FBD for ; Sat, 1 Dec 2012 18:40:15 -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 Xmh9k2ANhgx8 for ; Sat, 1 Dec 2012 18:40:14 -0800 (PST) Received: from dmz-mailsec-scanner-4.mit.edu (DMZ-MAILSEC-SCANNER-4.MIT.EDU [18.9.25.15]) by olra.theworths.org (Postfix) with ESMTP id C1895431FC0 for ; Sat, 1 Dec 2012 18:40:13 -0800 (PST) X-AuditID: 1209190f-b7fec6d00000090d-88-50babf8cdec6 Received: from mailhub-auth-1.mit.edu ( [18.9.21.35]) by dmz-mailsec-scanner-4.mit.edu (Symantec Messaging Gateway) with SMTP id 8F.F5.02317.C8FBAB05; Sat, 1 Dec 2012 21:40:12 -0500 (EST) Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id qB22eCdv013713; Sat, 1 Dec 2012 21:40:12 -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 qB22e61V025596 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Sat, 1 Dec 2012 21:40:10 -0500 (EST) Received: from amthrax by drake.dyndns.org with local (Exim 4.77) (envelope-from ) id 1TezTR-0000xV-SV; Sat, 01 Dec 2012 21:40:05 -0500 From: Austin Clements To: notmuch@notmuchmail.org Subject: [PATCH 03/10] show: Support --use-schema Date: Sat, 1 Dec 2012 21:39:55 -0500 Message-Id: <1354416002-3557-3-git-send-email-amdragon@mit.edu> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1354416002-3557-1-git-send-email-amdragon@mit.edu> References: <1354416002-3557-1-git-send-email-amdragon@mit.edu> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrIIsWRmVeSWpSXmKPExsUixCmqrNuzf1eAwYVtFhbXb85kdmD0eLbq FnMAYxSXTUpqTmZZapG+XQJXxu2LXcwFt4Qr+o8XNzDe4O9i5OSQEDCR2PStlw3CFpO4cG89 kM3FISSwj1Hi+9xXrBDOekaJBxfWMUI4D5kkjveuYoFw5jJKnH86hR2kn01AQ2Lb/uWMILaI gLTEzruzgdo5OJgF1CT+dKmAhIUFDCW2PG4HK2cRUJV4eP8MC4jNK2Av8eTBARaIMxQlup9N YANp5RRwkFjRzQMSFgIq+f/7GtsERv4FjAyrGGVTcqt0cxMzc4pTk3WLkxPz8lKLdE30cjNL 9FJTSjcxgkNGkn8H47eDSocYBTgYlXh4GWftChBiTSwrrsw9xCjJwaQkyntlB1CILyk/pTIj sTgjvqg0J7X4EKMEB7OSCC+LCVCONyWxsiq1KB8mJc3BoiTOezXlpr+QQHpiSWp2ampBahFM VoaDQ0mCt3ofUKNgUWp6akVaZk4JQpqJgxNkOA/Q8Ed7QYYXFyTmFmemQ+RPMSpKifNeA0kI gCQySvPgemEx/YpRHOgVYV5PkBU8wHQA1/0KaDAT0OA3y7aDDC5JREhJNTBWN398sqLlomNB 0NVIVi7F4t9xK4+ecuq6xXE37MQMixs2DMdDfhfIar1caeEtcrJbxnLJhcM+yzXUKhVl1mtd +ZPleb/x8TtP+50xDI4FdZxtC1/u+PlgRbzmHsk1sactZs3/LtAW8nMb0zbmdSY/j+rfe/D/ zIcH25dcNpzm4qPzNTlE8+EMJZbijERDLeai4kQAIttqPcQCAAA= 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, 02 Dec 2012 02:40:15 -0000 --- man/man1/notmuch-show.1 | 20 ++++++++++++++++++++ notmuch-client.h | 2 ++ notmuch-show.c | 3 +++ 3 files changed, 25 insertions(+) diff --git a/man/man1/notmuch-show.1 b/man/man1/notmuch-show.1 index 4481f21..e2fd0c2 100644 --- a/man/man1/notmuch-show.1 +++ b/man/man1/notmuch-show.1 @@ -108,6 +108,15 @@ message. .RS 4 .TP 4 +.BR \-\-use-schema=N + +Use the specified structured output schema 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 \-\-part=N Output the single decoded MIME part N of a single message. The search @@ -181,6 +190,17 @@ column of output from the .B notmuch search command. +.SH EXIT STATUS + +This command supports the following special exit status codes + +.TP +.B 20 +The requested schema version is too old. +.TP +.B 21 +The requested schema version is too new. + .SH SEE ALSO \fBnotmuch\fR(1), \fBnotmuch-config\fR(1), \fBnotmuch-count\fR(1), diff --git a/notmuch-client.h b/notmuch-client.h index 95c4dd7..d931bbf 100644 --- a/notmuch-client.h +++ b/notmuch-client.h @@ -142,6 +142,8 @@ chomp_newline (char *str) #define NOTMUCH_SCHEMA_CUR 1 /* The minimum schema version supported by the "search" command. */ #define NOTMUCH_SCHEMA_SEARCH 1 +/* The minimum schema version supported by the "show" command. */ +#define NOTMUCH_SCHEMA_SHOW 1 /* The schema version requested by the caller on the command line. If * no schema version is requested, this should be set to diff --git a/notmuch-show.c b/notmuch-show.c index 2fa2292..9d1f7c7 100644 --- a/notmuch-show.c +++ b/notmuch-show.c @@ -1059,6 +1059,7 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[])) { "mbox", NOTMUCH_FORMAT_MBOX }, { "raw", NOTMUCH_FORMAT_RAW }, { 0, 0 } } }, + { NOTMUCH_OPT_INT, ¬much_schema_version, "use-schema", 0, 0 }, { NOTMUCH_OPT_KEYWORD, &exclude, "exclude", 'x', (notmuch_keyword_t []){ { "true", EXCLUDE_TRUE }, { "false", EXCLUDE_FALSE }, @@ -1118,6 +1119,8 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[])) break; } + notmuch_exit_if_unsupported_schema ("show", NOTMUCH_SCHEMA_SHOW); + /* Default is entire-thread = FALSE except for format=json. */ if (entire_thread == ENTIRE_THREAD_DEFAULT) { if (format == &format_json) -- 1.7.10.4