diff --git a/man/mu-find.1 b/man/mu-find.1 index c9805939..dfc8c1ac 100644 --- a/man/mu-find.1 +++ b/man/mu-find.1 @@ -1,4 +1,4 @@ -.TH MU FIND 1 "12 February 2021" "User Manuals" +.TH MU FIND 1 "22 June 2021" "User Manuals" .SH NAME @@ -74,17 +74,17 @@ The table of replacement characters is superset of the list mentions for search parameters; the complete list: .nf - t \fBt\fRo: recipient - c \fBc\fRc: (carbon-copy) recipient - h Bcc: (blind carbon-copy, \fBh\fRidden) recipient - d Sent \fBd\fRate of the message - f Message sender (\fBf\fRrom:) - g Message flags (fla\fBg\fRs) - l Full path to the message (\fBl\fRocation) - p Message \fBp\fRriority (high, normal, low) - s Message \fBs\fRubject - i Message-\fBi\fRd - m \fBm\fRaildir + t \fBt\fRo: recipient + c \fBc\fRc: (carbon-copy) recipient + h Bcc: (blind carbon-copy, \fBh\fRidden) recipient + d Sent \fBd\fRate of the message + f Message sender (\fBf\fRrom:) + g Message flags (fla\fBg\fRs) + l Full path to the message (\fBl\fRocation) + p Message \fBp\fRriority (high, normal, low) + s Message \fBs\fRubject + i Message-\fBi\fRd + m \fBm\fRaildir v Mailing-list Id .fi @@ -162,7 +162,7 @@ same maildir. However, this option will delete any symlink it finds, so be careful. .nf - $ mu find grolsch --linksdir=~/Maildir/search --clearlinks + $ mu find grolsch --format=links --linksdir=~/Maildir/search --clearlinks .fi will store links to found messages in \fI~/Maildir/search\fR. If the directory diff --git a/mu/mu-cmd-find.cc b/mu/mu-cmd-find.cc index e6e1dd34..e56a6887 100644 --- a/mu/mu-cmd-find.cc +++ b/mu/mu-cmd-find.cc @@ -45,8 +45,8 @@ using namespace Mu; struct OutputInfo{ Xapian::docid docid{}; - bool is_first{}; - bool is_last{}; + bool header{}; + bool footer{}; Option match_info; }; @@ -231,8 +231,10 @@ static bool output_link (MuMsg *msg, const OutputInfo& info, const MuConfig *opts, GError **err) { - if (info.is_first && !prepare_links (opts, err)) - return FALSE; + if (info.header) + return prepare_links (opts, err); + else if (info.footer) + return true; return mu_maildir_link (mu_msg_get_path (msg), opts->linksdir, err); @@ -510,12 +512,12 @@ output_sexp (MuMsg *msg, const OutputInfo& info, const MuConfig *opts, GError ** static bool output_json (MuMsg *msg, const OutputInfo& info, const MuConfig *opts, GError **err) { - if (info.is_first) { + if (info.header) { g_print ("[\n"); return true; } - if (info.is_last) { + if (info.footer) { g_print("]\n"); return true; } @@ -542,13 +544,13 @@ print_attr_xml (const char* elm, const char *str) static bool output_xml (MuMsg *msg, const OutputInfo& info, const MuConfig *opts, GError **err) { - if (info.is_first) { + if (info.header) { g_print ("\n"); g_print ("\n"); return true; } - if (info.is_last) { + if (info.footer) { g_print ("\n"); return true; } @@ -594,7 +596,7 @@ output_query_results (const QueryResults& qres, const MuConfig *opts, GError **e return false; gboolean rv{true}; - output_func (NULL, FirstOutput, NULL, NULL); + output_func (NULL, FirstOutput, opts, NULL); for (auto&& item: qres) { @@ -610,7 +612,7 @@ output_query_results (const QueryResults& qres, const MuConfig *opts, GError **e if (!rv) break; } - output_func (NULL, LastOutput, NULL, NULL); + output_func (NULL, LastOutput, opts, NULL); return rv; }