mirror of https://github.com/djcb/mu.git
* some fixes for the help system
This commit is contained in:
parent
257374076c
commit
7d8a58896e
|
@ -154,13 +154,16 @@ config_options_group_index (void)
|
|||
&MU_CONFIG.my_addresses,
|
||||
"my e-mail address (regexp); can be used multiple times",
|
||||
"<address>"},
|
||||
{"autoupgrade", 0, 0, G_OPTION_ARG_NONE, &MU_CONFIG.autoupgrade,
|
||||
"auto-upgrade the database with new mu versions (false)", NULL},
|
||||
{"autoupgrade", 0, 0, G_OPTION_ARG_NONE,
|
||||
&MU_CONFIG.autoupgrade,
|
||||
"auto-upgrade the database with new mu versions (false)",
|
||||
NULL},
|
||||
{"nocleanup", 0, 0, G_OPTION_ARG_NONE, &MU_CONFIG.nocleanup,
|
||||
"don't clean up the database after indexing (false)", NULL},
|
||||
{"xbatchsize", 0, 0, G_OPTION_ARG_INT, &MU_CONFIG.xbatchsize,
|
||||
"set transaction batchsize for xapian commits (0)", NULL},
|
||||
{"max-msg-size", 0, 0, G_OPTION_ARG_INT, &MU_CONFIG.max_msg_size,
|
||||
{"max-msg-size", 0, 0, G_OPTION_ARG_INT,
|
||||
&MU_CONFIG.max_msg_size,
|
||||
"set the maximum size for message files", "<size>"},
|
||||
{NULL, 0, 0, 0, NULL, NULL, NULL}
|
||||
};
|
||||
|
@ -201,7 +204,8 @@ config_options_group_find (void)
|
|||
GOptionEntry entries[] = {
|
||||
{"fields", 'f', 0, G_OPTION_ARG_STRING, &MU_CONFIG.fields,
|
||||
"fields to display in the output", "<fields>"},
|
||||
{"sortfield", 's', 0, G_OPTION_ARG_STRING, &MU_CONFIG.sortfield,
|
||||
{"sortfield", 's', 0, G_OPTION_ARG_STRING,
|
||||
&MU_CONFIG.sortfield,
|
||||
"field to sort on", "<field>"},
|
||||
{"threads", 't', 0, G_OPTION_ARG_NONE, &MU_CONFIG.threads,
|
||||
"show message threads", NULL},
|
||||
|
@ -219,7 +223,8 @@ config_options_group_find (void)
|
|||
{"exec", 'e', 0, G_OPTION_ARG_STRING, &MU_CONFIG.exec,
|
||||
"execute command on each match message", "<command>"},
|
||||
{"after", 0, 0, G_OPTION_ARG_INT, &MU_CONFIG.after,
|
||||
"only show messages whose m_time > T (t_time)", "<timestamp>"},
|
||||
"only show messages whose m_time > T (t_time)",
|
||||
"<timestamp>"},
|
||||
{NULL, 0, 0, 0, NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
|
@ -361,7 +366,8 @@ config_options_group_extract (void)
|
|||
"save all parts (incl. non-attachments) (false)", NULL},
|
||||
{"parts", 0, 0, G_OPTION_ARG_STRING, &MU_CONFIG.parts,
|
||||
"save specific parts (comma-separated list)", "<parts>"},
|
||||
{"target-dir", 0, 0, G_OPTION_ARG_FILENAME, &MU_CONFIG.targetdir,
|
||||
{"target-dir", 0, 0, G_OPTION_ARG_FILENAME,
|
||||
&MU_CONFIG.targetdir,
|
||||
"target directory for saving", "<dir>"},
|
||||
{"overwrite", 0, 0, G_OPTION_ARG_NONE, &MU_CONFIG.overwrite,
|
||||
"overwrite existing files (false)", NULL},
|
||||
|
@ -370,7 +376,7 @@ config_options_group_extract (void)
|
|||
{NULL, 0, 0, 0, NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
MU_CONFIG.targetdir = g_strdup("."); /* default is the current dir */
|
||||
MU_CONFIG.targetdir = g_strdup("."); /* default is the current dir */
|
||||
|
||||
og = g_option_group_new("extract",
|
||||
"Options for the 'extract' command",
|
||||
|
@ -544,6 +550,8 @@ mu_config_show_help (MuConfigCmd cmd)
|
|||
GOptionGroup *group;
|
||||
char *cleanhelp;
|
||||
|
||||
g_return_if_fail (mu_config_cmd_is_valid(cmd));
|
||||
|
||||
ctx = g_option_context_new ("");
|
||||
g_option_context_set_main_group (ctx, config_options_group_mu());
|
||||
|
||||
|
|
|
@ -81,6 +81,10 @@ enum _MuConfigCmd {
|
|||
typedef enum _MuConfigCmd MuConfigCmd;
|
||||
|
||||
|
||||
#define mu_config_cmd_is_valid(C) \
|
||||
((C) > MU_CONFIG_CMD_UNKNOWN && (C) < MU_CONFIG_CMD_NONE)
|
||||
|
||||
|
||||
/* struct with all configuration options for mu; it will be filled
|
||||
* from the config file, and/or command line arguments */
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#-*-mode:org-*-
|
||||
#
|
||||
# Copyright (C) 2012 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
|
|
15
mu/mu.cc
15
mu/mu.cc
|
@ -35,8 +35,16 @@
|
|||
static void
|
||||
show_version (void)
|
||||
{
|
||||
g_print ("mu (mail indexer/searcher) version " VERSION "\n"
|
||||
"Copyright (C) 2008-2012 Dirk-Jan C. Binnema (GPLv3+)\n");
|
||||
const char* blurb =
|
||||
"mu (mail indexer/searcher) version " VERSION "\n"
|
||||
"Copyright (C) 2008-2012 Dirk-Jan C. Binnema\n"
|
||||
"License GPLv3+: GNU GPL version 3 or later "
|
||||
"<http://gnu.org/licenses/gpl.html>.\n"
|
||||
"This is free software: you are free to change "
|
||||
"and redistribute it.\n"
|
||||
"There is NO WARRANTY, to the extent permitted by law.";
|
||||
|
||||
g_print ("%s\n", blurb);
|
||||
}
|
||||
|
||||
|
||||
|
@ -58,7 +66,8 @@ handle_error (MuConfig *conf, GError *err)
|
|||
g_print ("database is empty; try 'mu index'");
|
||||
break;
|
||||
case MU_ERROR_IN_PARAMETERS:
|
||||
mu_config_show_help (conf->cmd);
|
||||
if (mu_config_cmd_is_valid(conf->cmd))
|
||||
mu_config_show_help (conf->cmd);
|
||||
break;
|
||||
default:break; /* nothing to do */
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue