--- man/man1/notmuch-reply.1 | 21 +++++++++++++++++++++ notmuch-client.h | 4 ++++ notmuch-reply.c | 3 +++ 3 files changed, 28 insertions(+) diff --git a/man/man1/notmuch-reply.1 b/man/man1/notmuch-reply.1 index d264060..71ff569 100644 --- a/man/man1/notmuch-reply.1 +++ b/man/man1/notmuch-reply.1 @@ -52,6 +52,16 @@ to create a reply message intelligently. Only produces In\-Reply\-To, References, To, Cc, and Bcc headers. .RE .RE + +.RS +.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 .TP 4 .BR \-\-reply\-to= ( all | sender ) @@ -93,6 +103,17 @@ replying to multiple messages at once, but the JSON format does not. .RE .RE +.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 d931bbf..0eb6b36 100644 --- a/notmuch-client.h +++ b/notmuch-client.h @@ -144,6 +144,10 @@ chomp_newline (char *str) #define NOTMUCH_SCHEMA_SEARCH 1 /* The minimum schema version supported by the "show" command. */ #define NOTMUCH_SCHEMA_SHOW 1 +/* The minimum schema version supported by the "reply" command. Reply + * uses show, so in general this must be >= NOTMUCH_SCHEMA_SHOW. + */ +#define NOTMUCH_SCHEMA_REPLY 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-reply.c b/notmuch-reply.c index e60a264..059a412 100644 --- a/notmuch-reply.c +++ b/notmuch-reply.c @@ -724,6 +724,7 @@ notmuch_reply_command (void *ctx, int argc, char *argv[]) { "json", FORMAT_JSON }, { "headers-only", FORMAT_HEADERS_ONLY }, { 0, 0 } } }, + { NOTMUCH_OPT_INT, ¬much_schema_version, "use-schema", 0, 0 }, { NOTMUCH_OPT_KEYWORD, &reply_all, "reply-to", 'r', (notmuch_keyword_t []){ { "all", TRUE }, { "sender", FALSE }, @@ -745,6 +746,8 @@ notmuch_reply_command (void *ctx, int argc, char *argv[]) else reply_format_func = notmuch_reply_format_default; + notmuch_exit_if_unsupported_schema ("reply", NOTMUCH_SCHEMA_REPLY); + config = notmuch_config_open (ctx, NULL, NULL); if (config == NULL) return 1; -- 1.7.10.4