* add --summary-len option for mu view, and document it.
This commit is contained in:
@ -171,8 +171,7 @@ meant for for debugging purposes.
|
||||
|
||||
.TP
|
||||
\fB\-k\fR, \fB\-\-summary\-len\fR=\fI<len>\fR
|
||||
output a summary based on up to \fI\len\fR lines of the message. Will read the
|
||||
first lines of the message, and remove any newlines. The default is
|
||||
output a summary based on up to \fI\len\fR lines of the message. The default is
|
||||
.B 0
|
||||
, or no summary.
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ mu view\- display an e-mail message file
|
||||
|
||||
.SH SYNOPSIS
|
||||
|
||||
.B mu view <file> [<files>]
|
||||
.B mu view [options] <file> [<files>]
|
||||
|
||||
.SH DESCRIPTION
|
||||
|
||||
@ -19,6 +19,15 @@ using
|
||||
Currently, the command shows some common headers (From:, To:, Cc:, Subject:
|
||||
and Date:) and the plain-text body of the message.
|
||||
|
||||
.SH OPTIONS
|
||||
|
||||
.TP
|
||||
\fB\-k\fR, \fB\-\-summary\-len\fR=\fI<len>\fR
|
||||
instead of the full message, output a summary based on up to \fI\len\fR lines
|
||||
of the message. The default is
|
||||
.B 0
|
||||
, which means 'show full body'.
|
||||
|
||||
.SH BUGS
|
||||
|
||||
There probably are some; please report bugs when you find them:
|
||||
|
||||
@ -366,7 +366,7 @@ mu_cmd_find (MuConfigOptions *opts)
|
||||
|
||||
/* we ignore fields for now */
|
||||
static gboolean
|
||||
view_file (const gchar *path, const gchar *fields)
|
||||
view_file (const gchar *path, const gchar *fields, size_t summary_len)
|
||||
{
|
||||
MuMsgGMime* msg;
|
||||
const char *field;
|
||||
@ -397,14 +397,21 @@ view_file (const gchar *path, const gchar *fields)
|
||||
g_print ("Date: %s\n",
|
||||
mu_msg_str_date_s (date));
|
||||
|
||||
field = mu_msg_gmime_get_body_text (msg);
|
||||
if (field)
|
||||
g_print ("\n%s\n", field);
|
||||
else
|
||||
/* not really an error */
|
||||
g_debug ("No text body found for %s", path);
|
||||
if (summary_len > 0) {
|
||||
field = mu_msg_gmime_get_summary (msg, summary_len);
|
||||
g_print ("Summary: %s\n", field ? field : "<none>");
|
||||
} else {
|
||||
|
||||
field = mu_msg_gmime_get_body_text (msg);
|
||||
if (field)
|
||||
g_print ("\n%s\n", field);
|
||||
else
|
||||
/* not really an error */
|
||||
g_debug ("No text body found for %s", path);
|
||||
}
|
||||
|
||||
mu_msg_gmime_destroy (msg);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -426,7 +433,8 @@ mu_cmd_view (MuConfigOptions *opts)
|
||||
|
||||
rv = TRUE;
|
||||
for (i = 1; opts->params[i] && rv; ++i)
|
||||
rv = view_file (opts->params[i], NULL);
|
||||
rv = view_file (opts->params[i], NULL,
|
||||
opts->summary_len);
|
||||
|
||||
mu_msg_gmime_uninit();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user