mu extract/view/verify: allow reading message from stdin

Fixes #1463.
This commit is contained in:
Dirk-Jan C. Binnema
2023-04-29 22:58:55 +03:00
parent 3a05dd8725
commit 9544473e35
7 changed files with 135 additions and 57 deletions

View File

@ -8,7 +8,7 @@
* SYNOPSIS
*mu [common-options] extract [options] <file>*
*mu [common-options] extract [options] [<file>]*
*mu [common-options] extract [options] <file> <pattern>*
@ -30,6 +30,10 @@ Without any options, *mu extract* simply outputs the list of leaf MIME-parts in
the message. Only 'leaf' MIME-parts (including RFC822 attachments) are
considered, *multipart/** etc. are ignored.
Without a filename parameter, ~mu extract~ reads a message from standard-input. In
that case, you cannot use the second, ~<pattern>~ parameter as this would be
ambiguous; instead, use the ~--matches~ option.
* EXTRACT OPTIONS
** -a, --save-attachments
@ -56,6 +60,11 @@ by default, ~mu~ transforms the attachment filenames a bit (such as by replacing
spaces by dashes); with this option, leave that to the minimum for creating
a legal filename in the target directory.
** --matches=<pattern>
Attachments with filenames matching the pattern will be extracted. The regular
expressions are basic PCRE, and are case-sensitive by default; see *pcre(3)* for
more details.
** --play
Try to 'play' (open) the attachment with the default application for the
particular file type. On MacOS, this uses the *open* program, on other platforms
@ -87,6 +96,11 @@ To extract an mp3-file, and play it in the default mp3-playing application:
$ mu extract --play msgfile 'whoopsididitagain.mp3'
#+end_example
when reading from standard-input, you need ~--matches~, so:
#+begin_example
$ cat msgfile | mu extract --play --matches 'whoopsididitagain.mp3'
#+end_example
#+include: "prefooter.inc" :minlevel 1
* SEE ALSO

View File

@ -7,7 +7,7 @@ mu verify - verify message signatures and display information about them
* SYNOPSIS
*mu [common-options] verify [options] <msgfile>*
*mu [common-options] verify [options] [<file> ... ]*
* DESCRIPTION
@ -15,6 +15,9 @@ mu verify - verify message signatures and display information about them
signatures) and displaying information about them. The sub-command works on
message files, and does not require the message to be indexed in the database.
If no message file is provided, the command expects the message on
standard-input.
* VERIFY OPTIONS
** -r, --auto-retrieve

View File

@ -7,7 +7,7 @@ mu view - display an e-mail message file
* SYNOPSIS
mu [common options] view [options] <file> [<files>]
mu [common options] view [options] [<file> ...]
* DESCRIPTION
@ -17,6 +17,9 @@ message files and does =not= require the message to be indexed in the database.
The command shows some common headers (From:, To:, Cc:, Bcc:, Subject: and
Date:), the list of attachments and the plain-text body of the message (if any).
If no message file is provided, the command expects the message on
standard-input.
* VIEW OPTIONS
** --summary-len=<number>