* paper over the missing options bug (WIP)
This commit is contained in:
@ -127,7 +127,7 @@ run_query (MuQuery *xapian, const gchar *query, MuConfig *opts, GError **err)
|
|||||||
qflags |= MU_QUERY_FLAG_THREADS;
|
qflags |= MU_QUERY_FLAG_THREADS;
|
||||||
if (opts->reverse)
|
if (opts->reverse)
|
||||||
qflags |= MU_QUERY_FLAG_DESCENDING;
|
qflags |= MU_QUERY_FLAG_DESCENDING;
|
||||||
if (opts->no_dups)
|
if (opts->skip_dups)
|
||||||
qflags |= MU_QUERY_FLAG_SKIP_DUPS;
|
qflags |= MU_QUERY_FLAG_SKIP_DUPS;
|
||||||
|
|
||||||
iter = mu_query_run (xapian, query, sortid, -1, qflags, err);
|
iter = mu_query_run (xapian, query, sortid, -1, qflags, err);
|
||||||
|
|||||||
@ -213,8 +213,8 @@ config_options_group_find (void)
|
|||||||
"use a bookmarked query", "<bookmark>"},
|
"use a bookmarked query", "<bookmark>"},
|
||||||
{"reverse", 'z', 0, G_OPTION_ARG_NONE, &MU_CONFIG.reverse,
|
{"reverse", 'z', 0, G_OPTION_ARG_NONE, &MU_CONFIG.reverse,
|
||||||
"sort in reverse (descending) order (z -> a)", NULL},
|
"sort in reverse (descending) order (z -> a)", NULL},
|
||||||
{"no-dups", 'u', 0, G_OPTION_ARG_NONE,
|
{"skip-dups", 'u', 0, G_OPTION_ARG_NONE,
|
||||||
&MU_CONFIG.no_dups,
|
&MU_CONFIG.skip_dups,
|
||||||
"show only the first of messages duplicates (false)", NULL},
|
"show only the first of messages duplicates (false)", NULL},
|
||||||
{"linksdir", 0, 0, G_OPTION_ARG_STRING, &MU_CONFIG.linksdir,
|
{"linksdir", 0, 0, G_OPTION_ARG_STRING, &MU_CONFIG.linksdir,
|
||||||
"output as symbolic links to a target maildir", "<dir>"},
|
"output as symbolic links to a target maildir", "<dir>"},
|
||||||
@ -596,7 +596,7 @@ mu_config_show_help (MuConfigCmd cmd)
|
|||||||
|
|
||||||
g_return_if_fail (mu_config_cmd_is_valid(cmd));
|
g_return_if_fail (mu_config_cmd_is_valid(cmd));
|
||||||
|
|
||||||
ctx = g_option_context_new ("");
|
ctx = g_option_context_new ("- mu help");
|
||||||
g_option_context_set_main_group (ctx, config_options_group_mu());
|
g_option_context_set_main_group (ctx, config_options_group_mu());
|
||||||
|
|
||||||
group = get_option_group (cmd);
|
group = get_option_group (cmd);
|
||||||
@ -654,6 +654,7 @@ parse_params (int *argcp, char ***argvp, GError **err)
|
|||||||
gboolean rv;
|
gboolean rv;
|
||||||
|
|
||||||
context = g_option_context_new("- mu general options");
|
context = g_option_context_new("- mu general options");
|
||||||
|
|
||||||
g_option_context_set_help_enabled (context, TRUE);
|
g_option_context_set_help_enabled (context, TRUE);
|
||||||
|
|
||||||
err = NULL;
|
err = NULL;
|
||||||
@ -663,7 +664,9 @@ parse_params (int *argcp, char ***argvp, GError **err)
|
|||||||
config_options_group_mu());
|
config_options_group_mu());
|
||||||
|
|
||||||
switch (MU_CONFIG.cmd) {
|
switch (MU_CONFIG.cmd) {
|
||||||
case MU_CONFIG_CMD_NONE: show_usage(); break;
|
case MU_CONFIG_CMD_NONE:
|
||||||
|
show_usage();
|
||||||
|
break;
|
||||||
case MU_CONFIG_CMD_HELP:
|
case MU_CONFIG_CMD_HELP:
|
||||||
/* 'help' is special; sucks in the options of the
|
/* 'help' is special; sucks in the options of the
|
||||||
* command after it */
|
* command after it */
|
||||||
@ -675,6 +678,7 @@ parse_params (int *argcp, char ***argvp, GError **err)
|
|||||||
if (group)
|
if (group)
|
||||||
g_option_context_add_group(context, group);
|
g_option_context_add_group(context, group);
|
||||||
rv = g_option_context_parse (context, argcp, argvp, err);
|
rv = g_option_context_parse (context, argcp, argvp, err);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
g_option_context_free (context);
|
g_option_context_free (context);
|
||||||
|
|
||||||
|
|||||||
@ -139,7 +139,7 @@ struct _MuConfig {
|
|||||||
gchar *exec; /* command to execute on the
|
gchar *exec; /* command to execute on the
|
||||||
* files for the matched
|
* files for the matched
|
||||||
* messages */
|
* messages */
|
||||||
gboolean no_dups; /* if there are multiple
|
gboolean skip_dups; /* if there are multiple
|
||||||
* messages with the same
|
* messages with the same
|
||||||
* msgid, show only the first
|
* msgid, show only the first
|
||||||
* one */
|
* one */
|
||||||
|
|||||||
17
mu/mu.cc
17
mu/mu.cc
@ -49,12 +49,15 @@ show_version (void)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
handle_error (MuConfig *conf, GError *err)
|
handle_error (MuConfig *conf, MuError merr, GError **err)
|
||||||
{
|
{
|
||||||
if (!err)
|
if (merr != MU_OK && !(err && *err)) {
|
||||||
return; /* nothing to do */
|
g_printerr ("mu: something went wrong\n");
|
||||||
|
return;
|
||||||
|
} else if (!(err && *err))
|
||||||
|
return;
|
||||||
|
|
||||||
switch (err->code) {
|
switch ((*err)->code) {
|
||||||
case MU_ERROR_XAPIAN_CANNOT_GET_WRITELOCK:
|
case MU_ERROR_XAPIAN_CANNOT_GET_WRITELOCK:
|
||||||
g_printerr ("maybe mu is already running?\n");
|
g_printerr ("maybe mu is already running?\n");
|
||||||
break;
|
break;
|
||||||
@ -74,8 +77,8 @@ handle_error (MuConfig *conf, GError *err)
|
|||||||
break; /* nothing to do */
|
break; /* nothing to do */
|
||||||
}
|
}
|
||||||
|
|
||||||
if (err)
|
if (*err)
|
||||||
g_printerr ("mu: %s\n", err->message);
|
g_printerr ("mu: %s\n", (*err)->message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -113,7 +116,7 @@ main (int argc, char *argv[])
|
|||||||
rv = mu_cmd_execute (conf, &err);
|
rv = mu_cmd_execute (conf, &err);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
handle_error (conf, err);
|
handle_error (conf, rv, &err);
|
||||||
g_clear_error (&err);
|
g_clear_error (&err);
|
||||||
|
|
||||||
mu_config_uninit (conf);
|
mu_config_uninit (conf);
|
||||||
|
|||||||
Reference in New Issue
Block a user