diff --git a/man/mu-find.1 b/man/mu-find.1 index 99974c79..2aae6098 100644 --- a/man/mu-find.1 +++ b/man/mu-find.1 @@ -171,8 +171,7 @@ meant for for debugging purposes. .TP \fB\-k\fR, \fB\-\-summary\-len\fR=\fI\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. diff --git a/man/mu-view.1 b/man/mu-view.1 index 96e934b4..2399c1ae 100644 --- a/man/mu-view.1 +++ b/man/mu-view.1 @@ -6,7 +6,7 @@ mu view\- display an e-mail message file .SH SYNOPSIS -.B mu view [] +.B mu view [options] [] .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\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: diff --git a/src/mu-cmd-find.c b/src/mu-cmd-find.c index 440dd8cf..154f80ab 100644 --- a/src/mu-cmd-find.c +++ b/src/mu-cmd-find.c @@ -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; @@ -396,15 +396,22 @@ view_file (const gchar *path, const gchar *fields) if (date) 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 : ""); + } 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();