* remove the '--print' option; it's implicit

This commit is contained in:
Dirk-Jan C. Binnema 2009-11-28 14:54:46 +02:00
parent b4551febd2
commit b93402f705
3 changed files with 10 additions and 30 deletions

View File

@ -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";
}

View File

@ -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 */

View File

@ -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)
@ -137,7 +117,7 @@ print_rows (MuQueryXapian *xapian, const gchar *query, MuConfigOptions *opts)
}
while (!mu_msg_xapian_is_done (row)) {
const char* fields = opts->fields;
const char* fields = opts->fields;
int printlen = 0;
while (*fields) {
const MuMsgField* field =
@ -168,13 +148,16 @@ do_output (MuQueryXapian *xapian, GSList *args, MuConfigOptions* opts)
gboolean retval = TRUE;
query = mu_query_xapian_combine (args, FALSE);
if (opts->xquery)
/* 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;
}