]> git.cworth.org Git - notmuch/blob - doc/man1/notmuch-show.rst
doc: document new option `show.extra_headers`
[notmuch] / doc / man1 / notmuch-show.rst
1 .. _notmuch-show(1):
2
3 ============
4 notmuch-show
5 ============
6
7 SYNOPSIS
8 ========
9
10 **notmuch** **show** [*option* ...] <*search-term*> ...
11
12 DESCRIPTION
13 ===========
14
15 Shows all messages matching the search terms.
16
17 See :any:`notmuch-search-terms(7)` for details of the supported syntax for
18 <search-terms>.
19
20 The messages will be grouped and sorted based on the threading (all
21 replies to a particular message will appear immediately after that
22 message in date order). The output is not indented by default, but depth
23 tags are printed so that proper indentation can be performed by a
24 post-processor (such as the emacs interface to notmuch).
25
26 Supported options for **show** include
27
28 .. program:: show
29
30 .. option:: --entire-thread=(true|false)
31
32    If true, **notmuch show** outputs all messages in the thread of
33    any message matching the search terms; if false, it outputs only
34    the matching messages. For ``--format=json`` and ``--format=sexp``
35    this defaults to true. For other formats, this defaults to false.
36
37 .. option:: --format=(text|json|sexp|mbox|raw)
38
39    text (default for messages)
40      The default plain-text format has all text-content MIME parts
41      decoded. Various components in the output, (**message**,
42      **header**, **body**, **attachment**, and MIME **part**), will
43      be delimited by easily-parsed markers. Each marker consists of
44      a Control-L character (ASCII decimal 12), the name of the
45      marker, and then either an opening or closing brace, ('{' or
46      '}'), to either open or close the component. For a multipart
47      MIME message, these parts will be nested.
48
49    json
50      The output is formatted with Javascript Object Notation
51      (JSON). This format is more robust than the text format for
52      automated processing. The nested structure of multipart MIME
53      messages is reflected in nested JSON output. By default JSON
54      output includes all messages in a matching thread; that is, by
55      default, ``--format=json`` sets ``--entire-thread``. The
56      caller can disable this behaviour by setting
57      ``--entire-thread=false``.  The JSON output is always encoded
58      as UTF-8 and any message content included in the output will
59      be charset-converted to UTF-8.
60
61    sexp
62      The output is formatted as the Lisp s-expression (sexp)
63      equivalent of the JSON format above. Objects are formatted as
64      property lists whose keys are keywords (symbols preceded by a
65      colon). True is formatted as ``t`` and both false and null are
66      formatted as ``nil``. As for JSON, the s-expression output is
67      always encoded as UTF-8.
68
69    mbox
70      All matching messages are output in the traditional, Unix mbox
71      format with each message being prefixed by a line beginning
72      with "From " and a blank line separating each message. Lines
73      in the message content beginning with "From " (preceded by
74      zero or more '>' characters) have an additional '>' character
75      added. This reversible escaping is termed "mboxrd" format and
76      described in detail here:
77
78        http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/mail-mbox-formats.html
79
80    raw (default if ``--part`` is given)
81      Write the raw bytes of the given MIME part of a message to
82      standard out. For this format, it is an error to specify a
83      query that matches more than one message.
84
85      If the specified part is a leaf part, this outputs the body of
86      the part after performing content transfer decoding (but no
87      charset conversion). This is suitable for saving attachments,
88      for example.
89
90      For a multipart or message part, the output includes the part
91      headers as well as the body (including all child parts). No
92      decoding is performed because multipart and message parts
93      cannot have non-trivial content transfer encoding. Consumers
94      of this may need to implement MIME decoding and similar
95      functions.
96
97 .. option:: --format-version=N
98
99    Use the specified structured output format version. This is
100    intended for programs that invoke :any:`notmuch(1)` internally. If
101    omitted, the latest supported version will be used.
102
103 .. option:: --part=N
104
105    Output the single decoded MIME part N of a single message. The
106    search terms must match only a single message. Message parts are
107    numbered in a depth-first walk of the message MIME structure, and
108    are identified in the 'json', 'sexp' or 'text' output formats.
109
110    Note that even a message with no MIME structure or a single body
111    part still has two MIME parts: part 0 is the whole message
112    (headers and body) and part 1 is just the body.
113
114 .. option:: --sort=(newest-first|oldest-first)
115
116    This option can be used to present results in either chronological
117    order (**oldest-first**) or reverse chronological order
118    (**newest-first**).
119
120    Only threads as a whole are reordered.  Ordering of messages within
121    each thread will not be affected by this flag, since that order is
122    always determined by the thread's replies.
123
124    By default, results will be displayed in reverse chronological
125    order, (that is, the newest results will be displayed first).
126
127 .. option:: --verify
128
129    Compute and report the validity of any MIME cryptographic
130    signatures found in the selected content (e.g., "multipart/signed"
131    parts). Status of the signature will be reported (currently only
132    supported with ``--format=json`` and ``--format=sexp``), and the
133    multipart/signed part will be replaced by the signed data.
134
135 .. option:: --decrypt=(false|auto|true|stash)
136
137    If ``true``, decrypt any MIME encrypted parts found in the
138    selected content (e.g., "multipart/encrypted" parts). Status of
139    the decryption will be reported (currently only supported
140    with ``--format=json`` and ``--format=sexp``) and on successful
141    decryption the multipart/encrypted part will be replaced by
142    the decrypted content.
143
144    ``stash`` behaves like ``true``, but upon successful decryption it
145    will also stash the message's session key in the database, and
146    index the cleartext of the message, enabling automatic decryption
147    in the future.
148
149    If ``auto``, and a session key is already known for the
150    message, then it will be decrypted, but notmuch will not try
151    to access the user's keys.
152
153    Use ``false`` to avoid even automatic decryption.
154
155    Non-automatic decryption (``stash`` or ``true``, in the absence of
156    a stashed session key) expects a functioning :manpage:`gpg-agent(1)` to
157    provide any needed credentials. Without one, the decryption will
158    fail.
159
160    Note: setting either ``true`` or ``stash`` here implies
161    ``--verify``.
162
163    Here is a table that summarizes each of these policies:
164
165    +------------------------+-------+------+------+-------+
166    |                        | false | auto | true | stash |
167    +========================+=======+======+======+=======+
168    | Show cleartext if      |       |  X   |  X   |   X   |
169    | session key is         |       |      |      |       |
170    | already known          |       |      |      |       |
171    +------------------------+-------+------+------+-------+
172    | Use secret keys to     |       |      |  X   |   X   |
173    | show cleartext         |       |      |      |       |
174    +------------------------+-------+------+------+-------+
175    | Stash any newly        |       |      |      |   X   |
176    | recovered session keys,|       |      |      |       |
177    | reindexing message if  |       |      |      |       |
178    | found                  |       |      |      |       |
179    +------------------------+-------+------+------+-------+
180
181    Note: ``--decrypt=stash`` requires write access to the database.
182    Otherwise, ``notmuch show`` operates entirely in read-only mode.
183
184    Default: ``auto``
185
186 .. option:: --exclude=(true|false)
187
188    Specify whether to omit threads only matching search.exclude\_tags
189    from the search results (the default) or not. In either case the
190    excluded message will be marked with the exclude flag (except when
191    output=mbox when there is nowhere to put the flag).
192
193    If ``--entire-thread`` is specified then complete threads are returned
194    regardless (with the excluded flag being set when appropriate) but
195    threads that only match in an excluded message are not returned
196    when ``--exclude=true.``
197
198    The default is ``--exclude=true.``
199
200 .. option:: --body=(true|false)
201
202    If true (the default) **notmuch show** includes the bodies of the
203    messages in the output; if false, bodies are omitted.
204    ``--body=false`` is only implemented for the text, json and sexp
205    formats and it is incompatible with ``--part > 0.``
206
207    This is useful if the caller only needs the headers as body-less
208    output is much faster and substantially smaller.
209
210 .. option:: --include-html
211
212    Include "text/html" parts as part of the output (currently
213    only supported with ``--format=text``, ``--format=json`` and
214    ``--format=sexp``). By default, unless ``--part=N`` is used to
215    select a specific part or ``--include-html`` is used to include all
216    "text/html" parts, no part with content type "text/html" is included
217    in the output.
218
219 A common use of **notmuch show** is to display a single thread of
220 email messages. For this, use a search term of "thread:<thread-id>" as
221 can be seen in the first column of output from the
222 :any:`notmuch-search(1)` command.
223
224 CONFIGURATION
225 =============
226
227 Structured output (json / sexp) is influenced by the configuration
228 option :ref:`show.extra_headers <show.extra_headers>`. See
229 :any:`notmuch-config(1)` for details.
230
231 EXIT STATUS
232 ===========
233
234 This command supports the following special exit status codes
235
236 ``20``
237     The requested format version is too old.
238
239 ``21``
240     The requested format version is too new.
241
242 SEE ALSO
243 ========
244
245 :any:`notmuch(1)`,
246 :any:`notmuch-config(1)`,
247 :any:`notmuch-count(1)`,
248 :any:`notmuch-dump(1)`,
249 :any:`notmuch-hooks(5)`,
250 :any:`notmuch-insert(1)`,
251 :any:`notmuch-new(1)`,
252 :any:`notmuch-reply(1)`,
253 :any:`notmuch-restore(1)`,
254 :any:`notmuch-search(1)`,
255 :any:`notmuch-search-terms(7)`,
256 :any:`notmuch-tag(1)`