From 6e916e03bddfce67d0c3563dc017323d0243db05 Mon Sep 17 00:00:00 2001 From: Magne Mahre Date: Tue, 3 Nov 2009 10:22:22 +0100 Subject: [PATCH] Bug#35224: mysqldump --help is very confusing The presence of "--skip" parameters is obscure, when it should be obvious from the text. Now, for boolean options, when they're default to ON and the --skip is more useful parameter, then tell the user of its existence. Backported from 6.0-codebase, revid 2572.14.1 --- client/mysqlcheck.c | 2 +- client/mysqldump.c | 2 +- mysys/my_getopt.c | 8 ++++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c index 1affea1d189..5c801eb6e26 100644 --- a/client/mysqlcheck.c +++ b/client/mysqlcheck.c @@ -128,7 +128,7 @@ static struct my_option my_long_options[] = "Faster than extended-check, but only finds 99.99 percent of all errors. Should be good enough for most cases.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"write-binlog", OPT_WRITE_BINLOG, - "Log ANALYZE, OPTIMIZE and REPAIR TABLE commands. Enabled by default; use --skip-write-binlog when commands should not be sent to replication slaves.", + "Log ANALYZE, OPTIMIZE and REPAIR TABLE commands. Use --skip-write-binlog when commands should not be sent to replication slaves.", (uchar**) &opt_write_binlog, (uchar**) &opt_write_binlog, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, {"optimize", 'o', "Optimize table.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, diff --git a/client/mysqldump.c b/client/mysqldump.c index aa81a0e98bf..1066ad4703a 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -402,7 +402,7 @@ static struct my_option my_long_options[] = (uchar**) &opt_routines, (uchar**) &opt_routines, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"set-charset", OPT_SET_CHARSET, - "Add 'SET NAMES default_character_set' to the output. Enabled by default; suppress with --skip-set-charset.", + "Add 'SET NAMES default_character_set' to the output.", (uchar**) &opt_set_charset, (uchar**) &opt_set_charset, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, {"set-variable", 'O', diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c index 22b1216f99c..533a29c9fd4 100644 --- a/mysys/my_getopt.c +++ b/mysys/my_getopt.c @@ -1220,6 +1220,14 @@ void my_print_help(const struct my_option *options) printf("%s", comment); } putchar('\n'); + if ((optp->var_type & GET_TYPE_MASK) == GET_NO_ARG || + (optp->var_type & GET_TYPE_MASK) == GET_BOOL) + { + if (optp->def_value != 0) + { + printf("%*s(Defaults to on; use --skip-%s to disable.)\n", name_space, "", optp->name); + } + } } }