Added maxnum argument to mu find.

This commit is contained in:
Titus von der Malsburg 2013-09-27 16:11:04 +02:00
parent d6c01a5975
commit 86e6c6c693
4 changed files with 10 additions and 1 deletions

View File

@ -1,4 +1,4 @@
.TH MU FIND 1 "June 2013" "User Manuals" .TH MU FIND 1 "September 2013" "User Manuals"
.SH NAME .SH NAME
@ -343,6 +343,10 @@ Note, if you specify a sortfield, by default, messages are sorted in reverse
(descending) order (e.g., from lowest to highest). This is usually a good (descending) order (e.g., from lowest to highest). This is usually a good
choice, but for dates it may be more useful to sort in the opposite direction. choice, but for dates it may be more useful to sort in the opposite direction.
.TP
\fB\-n\fR, \fB\-\-maxnum=<number>\fR
If > 0, display maximally that number of entries. If not specified, all matching entries are displayed.
.TP .TP
\fB\-\-summary-len=<number>\fR \fB\-\-summary-len=<number>\fR
If > 0, use that number of lines of the message to provide a summary. If > 0, use that number of lines of the message to provide a summary.

View File

@ -598,6 +598,8 @@ output_query_results (MuMsgIter *iter, MuConfig *opts, GError **err)
MuMsg *msg; MuMsg *msg;
if (opts->maxnum > 0 && count == opts->maxnum)
break;
msg = get_message (iter, opts->after); msg = get_message (iter, opts->after);
if (!msg) if (!msg)
break; break;

View File

@ -205,6 +205,8 @@ config_options_group_find (void)
{"sortfield", 's', 0, G_OPTION_ARG_STRING, {"sortfield", 's', 0, G_OPTION_ARG_STRING,
&MU_CONFIG.sortfield, &MU_CONFIG.sortfield,
"field to sort on", "<field>"}, "field to sort on", "<field>"},
{"maxnum", 'n', 0, G_OPTION_ARG_INT, &MU_CONFIG.maxnum,
"number of entries to display in the output", "<number>"},
{"threads", 't', 0, G_OPTION_ARG_NONE, &MU_CONFIG.threads, {"threads", 't', 0, G_OPTION_ARG_NONE, &MU_CONFIG.threads,
"show message threads", NULL}, "show message threads", NULL},
{"bookmark", 'b', 0, G_OPTION_ARG_STRING, &MU_CONFIG.bookmark, {"bookmark", 'b', 0, G_OPTION_ARG_STRING, &MU_CONFIG.bookmark,

View File

@ -123,6 +123,7 @@ struct _MuConfig {
/* options for querying 'find' (and view-> 'summary') */ /* options for querying 'find' (and view-> 'summary') */
gchar *fields; /* fields to show in output */ gchar *fields; /* fields to show in output */
gchar *sortfield; /* field to sort by (string) */ gchar *sortfield; /* field to sort by (string) */
int maxnum; /* max # of entries to print */
gboolean reverse; /* sort in revers order (z->a) */ gboolean reverse; /* sort in revers order (z->a) */
gboolean threads; /* show message threads */ gboolean threads; /* show message threads */