degesch: move the -d option to configuration

This commit is contained in:
Přemysl Eric Janouch 2015-07-11 04:28:34 +02:00
parent 8f587117f7
commit e2c0240a84
1 changed files with 13 additions and 4 deletions

View File

@ -1414,6 +1414,12 @@ static void refresh_prompt (struct app_context *ctx);
// --- Configuration ----------------------------------------------------------- // --- Configuration -----------------------------------------------------------
static void
on_config_debug_mode_change (struct config_item_ *item)
{
g_debug_mode = item->value.boolean;
}
static void on_config_attribute_change (struct config_item_ *item); static void on_config_attribute_change (struct config_item_ *item);
static void on_config_logging_change (struct config_item_ *item); static void on_config_logging_change (struct config_item_ *item);
@ -1428,6 +1434,8 @@ static void on_config_logging_change (struct config_item_ *item);
TRIVIAL_BOOLEAN_ON_CHANGE (isolate_buffers) TRIVIAL_BOOLEAN_ON_CHANGE (isolate_buffers)
TRIVIAL_BOOLEAN_ON_CHANGE (beep_on_highlight) TRIVIAL_BOOLEAN_ON_CHANGE (beep_on_highlight)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
static bool static bool
config_validate_nonjunk_string config_validate_nonjunk_string
(const struct config_item_ *item, struct error **e) (const struct config_item_ *item, struct error **e)
@ -1582,6 +1590,11 @@ static struct config_schema g_config_behaviour[] =
.comment = "Save configuration before quitting", .comment = "Save configuration before quitting",
.type = CONFIG_ITEM_BOOLEAN, .type = CONFIG_ITEM_BOOLEAN,
.default_ = "on" }, .default_ = "on" },
{ .name = "debug_mode",
.comment = "Produce some debugging output",
.type = CONFIG_ITEM_BOOLEAN,
.default_ = "off",
.on_change = on_config_debug_mode_change },
{} {}
}; };
@ -8997,7 +9010,6 @@ main (int argc, char *argv[])
static const struct opt opts[] = static const struct opt opts[] =
{ {
{ 'd', "debug", NULL, 0, "run in debug mode" },
{ 'h', "help", NULL, 0, "display this help and exit" }, { 'h', "help", NULL, 0, "display this help and exit" },
{ 'V', "version", NULL, 0, "output version information and exit" }, { 'V', "version", NULL, 0, "output version information and exit" },
{ 0, NULL, NULL, 0, NULL } { 0, NULL, NULL, 0, NULL }
@ -9010,9 +9022,6 @@ main (int argc, char *argv[])
while ((c = opt_handler_get (&oh)) != -1) while ((c = opt_handler_get (&oh)) != -1)
switch (c) switch (c)
{ {
case 'd':
g_debug_mode = true;
break;
case 'h': case 'h':
opt_handler_usage (&oh, stdout); opt_handler_usage (&oh, stdout);
exit (EXIT_SUCCESS); exit (EXIT_SUCCESS);