add description parameter to OPT__VERBOSE
authorRené Scharfe <rene.scharfe@lsrfire.ath.cx>
Mon, 8 Nov 2010 17:56:39 +0000 (18:56 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 15 Nov 2010 17:56:51 +0000 (09:56 -0800)
Allows better help text to be defined than "be verbose".  Also make use
of the macro in places that already had a different description.  No
object code changes intended.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 files changed:
Documentation/technical/api-parse-options.txt
archive.c
builtin/add.c
builtin/apply.c
builtin/branch.c
builtin/commit.c
builtin/count-objects.c
builtin/fsck.c
builtin/log.c
builtin/notes.c
builtin/prune.c
builtin/read-tree.c
builtin/remote.c
builtin/verify-tag.c
parse-options.h
test-parse-options.c

index c5d141c..969489b 100644 (file)
@@ -124,7 +124,7 @@ There are some macros to easily define options:
 `OPT__QUIET(&int_var)`::
        Add `-q, \--quiet`.
 
 `OPT__QUIET(&int_var)`::
        Add `-q, \--quiet`.
 
-`OPT__VERBOSE(&int_var)`::
+`OPT__VERBOSE(&int_var, description)`::
        Add `-v, \--verbose`.
 
 `OPT_GROUP(description)`::
        Add `-v, \--verbose`.
 
 `OPT_GROUP(description)`::
index f59afda..78a67f0 100644 (file)
--- a/archive.c
+++ b/archive.c
@@ -314,7 +314,7 @@ static int parse_archive_args(int argc, const char **argv,
                        "write the archive to this file"),
                OPT_BOOLEAN(0, "worktree-attributes", &worktree_attributes,
                        "read .gitattributes in working directory"),
                        "write the archive to this file"),
                OPT_BOOLEAN(0, "worktree-attributes", &worktree_attributes,
                        "read .gitattributes in working directory"),
-               OPT__VERBOSE(&verbose),
+               OPT__VERBOSE(&verbose, "be verbose"),
                OPT__COMPR('0', &compression_level, "store only", 0),
                OPT__COMPR('1', &compression_level, "compress faster", 1),
                OPT__COMPR_HIDDEN('2', &compression_level, 2),
                OPT__COMPR('0', &compression_level, "store only", 0),
                OPT__COMPR('1', &compression_level, "compress faster", 1),
                OPT__COMPR_HIDDEN('2', &compression_level, 2),
index 56a4e0a..fbf1403 100644 (file)
@@ -314,7 +314,7 @@ static int ignore_add_errors, addremove, intent_to_add, ignore_missing = 0;
 
 static struct option builtin_add_options[] = {
        OPT__DRY_RUN(&show_only),
 
 static struct option builtin_add_options[] = {
        OPT__DRY_RUN(&show_only),
-       OPT__VERBOSE(&verbose),
+       OPT__VERBOSE(&verbose, "be verbose"),
        OPT_GROUP(""),
        OPT_BOOLEAN('i', "interactive", &add_interactive, "interactive picking"),
        OPT_BOOLEAN('p', "patch", &patch_interactive, "interactive patching"),
        OPT_GROUP(""),
        OPT_BOOLEAN('i', "interactive", &add_interactive, "interactive picking"),
        OPT_BOOLEAN('p', "patch", &patch_interactive, "interactive patching"),
index 23c18c5..e1e9ecc 100644 (file)
@@ -3843,7 +3843,7 @@ int cmd_apply(int argc, const char **argv, const char *prefix_)
                        "don't expect at least one line of context"),
                OPT_BOOLEAN(0, "reject", &apply_with_reject,
                        "leave the rejected hunks in corresponding *.rej files"),
                        "don't expect at least one line of context"),
                OPT_BOOLEAN(0, "reject", &apply_with_reject,
                        "leave the rejected hunks in corresponding *.rej files"),
-               OPT__VERBOSE(&apply_verbosely),
+               OPT__VERBOSE(&apply_verbosely, "be verbose"),
                OPT_BIT(0, "inaccurate-eof", &options,
                        "tolerate incorrectly detected missing new-line at the end of file",
                        INACCURATE_EOF),
                OPT_BIT(0, "inaccurate-eof", &options,
                        "tolerate incorrectly detected missing new-line at the end of file",
                        INACCURATE_EOF),
index 87976f0..10788fc 100644 (file)
@@ -621,7 +621,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
 
        struct option options[] = {
                OPT_GROUP("Generic options"),
 
        struct option options[] = {
                OPT_GROUP("Generic options"),
-               OPT__VERBOSE(&verbose),
+               OPT__VERBOSE(&verbose, "be verbose"),
                OPT_SET_INT('t', "track",  &track, "set up tracking mode (see git-pull(1))",
                        BRANCH_TRACK_EXPLICIT),
                OPT_SET_INT( 0, "set-upstream",  &track, "change upstream info",
                OPT_SET_INT('t', "track",  &track, "set up tracking mode (see git-pull(1))",
                        BRANCH_TRACK_EXPLICIT),
                OPT_SET_INT( 0, "set-upstream",  &track, "change upstream info",
index 66fdd22..9cbc4ea 100644 (file)
@@ -115,7 +115,7 @@ static int opt_parse_m(const struct option *opt, const char *arg, int unset)
 
 static struct option builtin_commit_options[] = {
        OPT__QUIET(&quiet),
 
 static struct option builtin_commit_options[] = {
        OPT__QUIET(&quiet),
-       OPT__VERBOSE(&verbose),
+       OPT__VERBOSE(&verbose, "be verbose"),
 
        OPT_GROUP("Commit message options"),
        OPT_FILENAME('F', "file", &logfile, "read log from file"),
 
        OPT_GROUP("Commit message options"),
        OPT_FILENAME('F', "file", &logfile, "read log from file"),
@@ -1048,7 +1048,7 @@ int cmd_status(int argc, const char **argv, const char *prefix)
        int fd;
        unsigned char sha1[20];
        static struct option builtin_status_options[] = {
        int fd;
        unsigned char sha1[20];
        static struct option builtin_status_options[] = {
-               OPT__VERBOSE(&verbose),
+               OPT__VERBOSE(&verbose, "be verbose"),
                OPT_SET_INT('s', "short", &status_format,
                            "show status concisely", STATUS_FORMAT_SHORT),
                OPT_BOOLEAN('b', "branch", &status_show_branch,
                OPT_SET_INT('s', "short", &status_format,
                            "show status concisely", STATUS_FORMAT_SHORT),
                OPT_BOOLEAN('b', "branch", &status_show_branch,
index 2bdd8eb..c37cb98 100644 (file)
@@ -79,7 +79,7 @@ int cmd_count_objects(int argc, const char **argv, const char *prefix)
        unsigned long loose = 0, packed = 0, packed_loose = 0, garbage = 0;
        off_t loose_size = 0;
        struct option opts[] = {
        unsigned long loose = 0, packed = 0, packed_loose = 0, garbage = 0;
        off_t loose_size = 0;
        struct option opts[] = {
-               OPT__VERBOSE(&verbose),
+               OPT__VERBOSE(&verbose, "be verbose"),
                OPT_END(),
        };
 
                OPT_END(),
        };
 
index 0929c7f..6d5ebca 100644 (file)
@@ -572,7 +572,7 @@ static char const * const fsck_usage[] = {
 };
 
 static struct option fsck_opts[] = {
 };
 
 static struct option fsck_opts[] = {
-       OPT__VERBOSE(&verbose),
+       OPT__VERBOSE(&verbose, "be verbose"),
        OPT_BOOLEAN(0, "unreachable", &show_unreachable, "show unreachable objects"),
        OPT_BOOLEAN(0, "tags", &show_tags, "report tags"),
        OPT_BOOLEAN(0, "root", &show_root, "report root nodes"),
        OPT_BOOLEAN(0, "unreachable", &show_unreachable, "show unreachable objects"),
        OPT_BOOLEAN(0, "tags", &show_tags, "report tags"),
        OPT_BOOLEAN(0, "root", &show_root, "report root nodes"),
index 22d1290..d0297a1 100644 (file)
@@ -1365,7 +1365,7 @@ int cmd_cherry(int argc, const char **argv, const char *prefix)
 
        struct option options[] = {
                OPT__ABBREV(&abbrev),
 
        struct option options[] = {
                OPT__ABBREV(&abbrev),
-               OPT__VERBOSE(&verbose),
+               OPT__VERBOSE(&verbose, "be verbose"),
                OPT_END()
        };
 
                OPT_END()
        };
 
index 6d07aac..e0a1f62 100644 (file)
@@ -806,7 +806,7 @@ static int prune(int argc, const char **argv, const char *prefix)
        struct option options[] = {
                OPT_BOOLEAN('n', "dry-run", &show_only,
                            "do not remove, show only"),
        struct option options[] = {
                OPT_BOOLEAN('n', "dry-run", &show_only,
                            "do not remove, show only"),
-               OPT_BOOLEAN('v', "verbose", &verbose, "report pruned notes"),
+               OPT__VERBOSE(&verbose, "report pruned notes"),
                OPT_END()
        };
 
                OPT_END()
        };
 
index 99218ba..8b770af 100644 (file)
@@ -127,7 +127,7 @@ int cmd_prune(int argc, const char **argv, const char *prefix)
        const struct option options[] = {
                OPT_BOOLEAN('n', "dry-run", &show_only,
                            "do not remove, show only"),
        const struct option options[] = {
                OPT_BOOLEAN('n', "dry-run", &show_only,
                            "do not remove, show only"),
-               OPT_BOOLEAN('v', "verbose", &verbose, "report pruned objects"),
+               OPT__VERBOSE(&verbose, "report pruned objects"),
                OPT_DATE(0, "expire", &expire,
                         "expire objects older than <time>"),
                OPT_END()
                OPT_DATE(0, "expire", &expire,
                         "expire objects older than <time>"),
                OPT_END()
index eb1e3e7..73c89ed 100644 (file)
@@ -109,7 +109,7 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix)
                  PARSE_OPT_NONEG, index_output_cb },
                OPT_SET_INT(0, "empty", &read_empty,
                            "only empty the index", 1),
                  PARSE_OPT_NONEG, index_output_cb },
                OPT_SET_INT(0, "empty", &read_empty,
                            "only empty the index", 1),
-               OPT__VERBOSE(&opts.verbose_update),
+               OPT__VERBOSE(&opts.verbose_update, "be verbose"),
                OPT_GROUP("Merging"),
                OPT_SET_INT('m', NULL, &opts.merge,
                            "perform a merge in addition to a read", 1),
                OPT_GROUP("Merging"),
                OPT_SET_INT('m', NULL, &opts.merge,
                            "perform a merge in addition to a read", 1),
index e9a6e09..b944b91 100644 (file)
@@ -1512,7 +1512,7 @@ static int show_all(void)
 int cmd_remote(int argc, const char **argv, const char *prefix)
 {
        struct option options[] = {
 int cmd_remote(int argc, const char **argv, const char *prefix)
 {
        struct option options[] = {
-               OPT_BOOLEAN('v', "verbose", &verbose, "be verbose; must be placed before a subcommand"),
+               OPT__VERBOSE(&verbose, "be verbose; must be placed before a subcommand"),
                OPT_END()
        };
        int result;
                OPT_END()
        };
        int result;
index 9f482c2..6784846 100644 (file)
@@ -93,7 +93,7 @@ int cmd_verify_tag(int argc, const char **argv, const char *prefix)
 {
        int i = 1, verbose = 0, had_error = 0;
        const struct option verify_tag_options[] = {
 {
        int i = 1, verbose = 0, had_error = 0;
        const struct option verify_tag_options[] = {
-               OPT__VERBOSE(&verbose),
+               OPT__VERBOSE(&verbose, "be verbose"),
                OPT_END()
        };
 
                OPT_END()
        };
 
index d982f0f..14918b1 100644 (file)
@@ -198,7 +198,7 @@ extern int parse_opt_verbosity_cb(const struct option *, const char *, int);
 extern int parse_opt_with_commit(const struct option *, const char *, int);
 extern int parse_opt_tertiary(const struct option *, const char *, int);
 
 extern int parse_opt_with_commit(const struct option *, const char *, int);
 extern int parse_opt_tertiary(const struct option *, const char *, int);
 
-#define OPT__VERBOSE(var)  OPT_BOOLEAN('v', "verbose", (var), "be verbose")
+#define OPT__VERBOSE(var, h)  OPT_BOOLEAN('v', "verbose", (var), (h))
 #define OPT__QUIET(var)    OPT_BOOLEAN('q', "quiet",   (var), "be quiet")
 #define OPT__VERBOSITY(var) \
        { OPTION_CALLBACK, 'v', "verbose", (var), NULL, "be more verbose", \
 #define OPT__QUIET(var)    OPT_BOOLEAN('q', "quiet",   (var), "be quiet")
 #define OPT__VERBOSITY(var) \
        { OPTION_CALLBACK, 'v', "verbose", (var), NULL, "be more verbose", \
index acd1a2b..bd7b8a4 100644 (file)
@@ -66,7 +66,7 @@ int main(int argc, const char **argv)
                  "negative ambiguity", PARSE_OPT_NOARG | PARSE_OPT_NONEG },
                OPT_GROUP("Standard options"),
                OPT__ABBREV(&abbrev),
                  "negative ambiguity", PARSE_OPT_NOARG | PARSE_OPT_NONEG },
                OPT_GROUP("Standard options"),
                OPT__ABBREV(&abbrev),
-               OPT__VERBOSE(&verbose),
+               OPT__VERBOSE(&verbose, "be verbose"),
                OPT__DRY_RUN(&dry_run),
                OPT__QUIET(&quiet),
                OPT_END(),
                OPT__DRY_RUN(&dry_run),
                OPT__QUIET(&quiet),
                OPT_END(),