mirror of https://github.com/djcb/mu.git
mu-cmd-find: Fix links ouput
Special case the footer/header for the links output. Small code cleanups. Fix error in docs. Fixes: #2035.
This commit is contained in:
parent
047c10453a
commit
9020389a56
|
@ -1,4 +1,4 @@
|
||||||
.TH MU FIND 1 "12 February 2021" "User Manuals"
|
.TH MU FIND 1 "22 June 2021" "User Manuals"
|
||||||
|
|
||||||
.SH NAME
|
.SH NAME
|
||||||
|
|
||||||
|
@ -74,17 +74,17 @@ The table of replacement characters is superset of the list mentions for
|
||||||
search parameters; the complete list:
|
search parameters; the complete list:
|
||||||
|
|
||||||
.nf
|
.nf
|
||||||
t \fBt\fRo: recipient
|
t \fBt\fRo: recipient
|
||||||
c \fBc\fRc: (carbon-copy) recipient
|
c \fBc\fRc: (carbon-copy) recipient
|
||||||
h Bcc: (blind carbon-copy, \fBh\fRidden) recipient
|
h Bcc: (blind carbon-copy, \fBh\fRidden) recipient
|
||||||
d Sent \fBd\fRate of the message
|
d Sent \fBd\fRate of the message
|
||||||
f Message sender (\fBf\fRrom:)
|
f Message sender (\fBf\fRrom:)
|
||||||
g Message flags (fla\fBg\fRs)
|
g Message flags (fla\fBg\fRs)
|
||||||
l Full path to the message (\fBl\fRocation)
|
l Full path to the message (\fBl\fRocation)
|
||||||
p Message \fBp\fRriority (high, normal, low)
|
p Message \fBp\fRriority (high, normal, low)
|
||||||
s Message \fBs\fRubject
|
s Message \fBs\fRubject
|
||||||
i Message-\fBi\fRd
|
i Message-\fBi\fRd
|
||||||
m \fBm\fRaildir
|
m \fBm\fRaildir
|
||||||
v Mailing-list Id
|
v Mailing-list Id
|
||||||
.fi
|
.fi
|
||||||
|
|
||||||
|
@ -162,7 +162,7 @@ same maildir. However, this option will delete any symlink it finds,
|
||||||
so be careful.
|
so be careful.
|
||||||
|
|
||||||
.nf
|
.nf
|
||||||
$ mu find grolsch --linksdir=~/Maildir/search --clearlinks
|
$ mu find grolsch --format=links --linksdir=~/Maildir/search --clearlinks
|
||||||
.fi
|
.fi
|
||||||
|
|
||||||
will store links to found messages in \fI~/Maildir/search\fR. If the directory
|
will store links to found messages in \fI~/Maildir/search\fR. If the directory
|
||||||
|
|
|
@ -45,8 +45,8 @@ using namespace Mu;
|
||||||
|
|
||||||
struct OutputInfo{
|
struct OutputInfo{
|
||||||
Xapian::docid docid{};
|
Xapian::docid docid{};
|
||||||
bool is_first{};
|
bool header{};
|
||||||
bool is_last{};
|
bool footer{};
|
||||||
Option<QueryMatch&> match_info;
|
Option<QueryMatch&> match_info;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -231,8 +231,10 @@ static bool
|
||||||
output_link (MuMsg *msg, const OutputInfo& info,
|
output_link (MuMsg *msg, const OutputInfo& info,
|
||||||
const MuConfig *opts, GError **err)
|
const MuConfig *opts, GError **err)
|
||||||
{
|
{
|
||||||
if (info.is_first && !prepare_links (opts, err))
|
if (info.header)
|
||||||
return FALSE;
|
return prepare_links (opts, err);
|
||||||
|
else if (info.footer)
|
||||||
|
return true;
|
||||||
|
|
||||||
return mu_maildir_link (mu_msg_get_path (msg),
|
return mu_maildir_link (mu_msg_get_path (msg),
|
||||||
opts->linksdir, err);
|
opts->linksdir, err);
|
||||||
|
@ -510,12 +512,12 @@ output_sexp (MuMsg *msg, const OutputInfo& info, const MuConfig *opts, GError **
|
||||||
static bool
|
static bool
|
||||||
output_json (MuMsg *msg, const OutputInfo& info, const MuConfig *opts, GError **err)
|
output_json (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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info.is_last) {
|
if (info.footer) {
|
||||||
g_print("]\n");
|
g_print("]\n");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -542,13 +544,13 @@ print_attr_xml (const char* elm, const char *str)
|
||||||
static bool
|
static bool
|
||||||
output_xml (MuMsg *msg, const OutputInfo& info, const MuConfig *opts, GError **err)
|
output_xml (MuMsg *msg, const OutputInfo& info, const MuConfig *opts, GError **err)
|
||||||
{
|
{
|
||||||
if (info.is_first) {
|
if (info.header) {
|
||||||
g_print ("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
|
g_print ("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
|
||||||
g_print ("<messages>\n");
|
g_print ("<messages>\n");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info.is_last) {
|
if (info.footer) {
|
||||||
g_print ("</messages>\n");
|
g_print ("</messages>\n");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -594,7 +596,7 @@ output_query_results (const QueryResults& qres, const MuConfig *opts, GError **e
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
gboolean rv{true};
|
gboolean rv{true};
|
||||||
output_func (NULL, FirstOutput, NULL, NULL);
|
output_func (NULL, FirstOutput, opts, NULL);
|
||||||
|
|
||||||
for (auto&& item: qres) {
|
for (auto&& item: qres) {
|
||||||
|
|
||||||
|
@ -610,7 +612,7 @@ output_query_results (const QueryResults& qres, const MuConfig *opts, GError **e
|
||||||
if (!rv)
|
if (!rv)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
output_func (NULL, LastOutput, NULL, NULL);
|
output_func (NULL, LastOutput, opts, NULL);
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue