From 36522fca1cac6ca23c2c4c0280e3e20e96f7bfbb Mon Sep 17 00:00:00 2001 From: "craven@gmx.net" Date: Mon, 23 Jul 2012 12:39:45 +0200 Subject: Add structured output formatter for JSON and plain text (but don't use them yet). Using the new structured printer support in sprinter.h, implement sprinter_json_create, which returns a new JSON structured output formatter. The formatter prints output similar to the existing JSON, but with differences in whitespace (mostly newlines, --output=summary prints the entire message summary on one line, not split across multiple lines). Also implement a "structured" formatter for plain text that prints prefixed strings, to be used with notmuch-search.c plain text output. --- sprinter.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'sprinter.h') diff --git a/sprinter.h b/sprinter.h index 77dc26f3..6680d419 100644 --- a/sprinter.h +++ b/sprinter.h @@ -55,4 +55,14 @@ typedef struct sprinter { notmuch_bool_t is_text_printer; } sprinter_t; + +/* Create a new unstructured printer that emits the default text format + * for "notmuch search". */ +struct sprinter * +sprinter_text_create (const void *ctx, FILE *stream); + +/* Create a new structure printer that emits JSON. */ +struct sprinter * +sprinter_json_create (const void *ctx, FILE *stream); + #endif // NOTMUCH_SPRINTER_H -- cgit v1.2.3