mirror of https://github.com/djcb/mu.git
* remove the '--print' option; it's implicit
This commit is contained in:
parent
b4551febd2
commit
b93402f705
|
@ -71,8 +71,6 @@ mu_config_options_group_query (MuConfigOptions *opts)
|
|||
{
|
||||
GOptionGroup *og;
|
||||
GOptionEntry entries[] = {
|
||||
{"print", 'p', 0, G_OPTION_ARG_NONE, &opts->print,
|
||||
"print matching messages to screen (default)", NULL},
|
||||
{"xquery", 'x', 0, G_OPTION_ARG_NONE, &opts->xquery,
|
||||
"print a string representation of the Xapian query", NULL},
|
||||
{"fields", 'f', 0, G_OPTION_ARG_STRING, &opts->fields,
|
||||
|
@ -114,7 +112,6 @@ mu_config_set_defaults (MuConfigOptions *opts)
|
|||
opts->reindex = FALSE;
|
||||
|
||||
/* querying */
|
||||
opts->print = TRUE;
|
||||
opts->xquery = FALSE;
|
||||
opts->fields = "d f s";
|
||||
}
|
||||
|
|
|
@ -38,8 +38,8 @@ struct _MuConfigOptions {
|
|||
gboolean reindex; /* re-index existing mails */
|
||||
|
||||
/* options for querying */
|
||||
gboolean print; /* do output */
|
||||
gboolean xquery; /* give the Xapian query (for debuging)*/
|
||||
gboolean xquery; /* give the Xapian query instead of
|
||||
search results */
|
||||
char *fields; /* fields to show in output */
|
||||
|
||||
char* sortfield_str; /* fields to sort by */
|
||||
|
|
|
@ -76,7 +76,7 @@ display_field (MuMsgXapian *row, const MuMsgField* field)
|
|||
|
||||
|
||||
static gboolean
|
||||
handle_options_sort_field_dir (MuConfigOptions *opts)
|
||||
handle_options (MuConfigOptions *opts)
|
||||
{
|
||||
const MuMsgField *field;
|
||||
|
||||
|
@ -102,26 +102,6 @@ handle_options_sort_field_dir (MuConfigOptions *opts)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
handle_options (MuConfigOptions *opts)
|
||||
{
|
||||
/* if nothing specified, or fields are specified use print */
|
||||
if ((!opts->xquery)||opts->fields)
|
||||
opts->print = TRUE;
|
||||
|
||||
/* if no fields are specified, use 'd f s' */
|
||||
if (opts->print && !opts->fields) {
|
||||
opts->fields = "d f s"; /* default: date-from-subject.. */
|
||||
if (!opts->ascending_flag) /* ... and sort descending */
|
||||
opts->sortdir_ascending = FALSE;
|
||||
}
|
||||
|
||||
if (!handle_options_sort_field_dir (opts))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static gboolean
|
||||
print_rows (MuQueryXapian *xapian, const gchar *query, MuConfigOptions *opts)
|
||||
|
@ -168,13 +148,16 @@ do_output (MuQueryXapian *xapian, GSList *args, MuConfigOptions* opts)
|
|||
gboolean retval = TRUE;
|
||||
|
||||
query = mu_query_xapian_combine (args, FALSE);
|
||||
|
||||
/* if xquery is set, we print the xapian query instead of the
|
||||
* output; this is for debugging purposes */
|
||||
if (opts->xquery)
|
||||
retval = print_query (xapian, query);
|
||||
|
||||
if (retval && opts->print)
|
||||
else
|
||||
retval = print_rows (xapian, query, opts);
|
||||
|
||||
g_free (query);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue