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