@matheusbsbs / matheus-bagliano / commits / fd03881a48
Fork 0

add description parameter to OPT__VERBOSE

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>

René Scharfe committed Nov 8, 2010 at 18:56 UTC fd03881a48fc31197ab3343ac2f02ed0cdbbbaaf
16 files changed +17 -17
Documentation/technical/api-parse-options.txt
+1 -1
@@ -124,7 +124,7 @@ There are some macros to easily define options:
124 `OPT__QUIET(&int_var)`::
125 Add `-q, \--quiet`.
126
127 -`OPT__VERBOSE(&int_var)`::
127 +`OPT__VERBOSE(&int_var, description)`::
128 Add `-v, \--verbose`.
129
130 `OPT_GROUP(description)`::
archive.c
+1 -1
@@ -314,7 +314,7 @@ static int parse_archive_args(int argc, const char **argv,
314 "write the archive to this file"),
315 OPT_BOOLEAN(0, "worktree-attributes", &worktree_attributes,
316 "read .gitattributes in working directory"),
317 - OPT__VERBOSE(&verbose),
317 + OPT__VERBOSE(&verbose, "be verbose"),
318 OPT__COMPR('0', &compression_level, "store only", 0),
319 OPT__COMPR('1', &compression_level, "compress faster", 1),
320 OPT__COMPR_HIDDEN('2', &compression_level, 2),
builtin/add.c
+1 -1
@@ -314,7 +314,7 @@ static int ignore_add_errors, addremove, intent_to_add, ignore_missing = 0;
314
315 static struct option builtin_add_options[] = {
316 OPT__DRY_RUN(&show_only),
317 - OPT__VERBOSE(&verbose),
317 + OPT__VERBOSE(&verbose, "be verbose"),
318 OPT_GROUP(""),
319 OPT_BOOLEAN('i', "interactive", &add_interactive, "interactive picking"),
320 OPT_BOOLEAN('p', "patch", &patch_interactive, "interactive patching"),
builtin/apply.c
+1 -1
@@ -3843,7 +3843,7 @@ int cmd_apply(int argc, const char **argv, const char *prefix_)
3843 "don't expect at least one line of context"),
3844 OPT_BOOLEAN(0, "reject", &apply_with_reject,
3845 "leave the rejected hunks in corresponding *.rej files"),
3846 - OPT__VERBOSE(&apply_verbosely),
3846 + OPT__VERBOSE(&apply_verbosely, "be verbose"),
3847 OPT_BIT(0, "inaccurate-eof", &options,
3848 "tolerate incorrectly detected missing new-line at the end of file",
3849 INACCURATE_EOF),
builtin/branch.c
+1 -1
@@ -621,7 +621,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
621
622 struct option options[] = {
623 OPT_GROUP("Generic options"),
624 - OPT__VERBOSE(&verbose),
624 + OPT__VERBOSE(&verbose, "be verbose"),
625 OPT_SET_INT('t', "track", &track, "set up tracking mode (see git-pull(1))",
626 BRANCH_TRACK_EXPLICIT),
627 OPT_SET_INT( 0, "set-upstream", &track, "change upstream info",
builtin/commit.c
+2 -2
@@ -115,7 +115,7 @@ static int opt_parse_m(const struct option *opt, const char *arg, int unset)
115
116 static struct option builtin_commit_options[] = {
117 OPT__QUIET(&quiet),
118 - OPT__VERBOSE(&verbose),
118 + OPT__VERBOSE(&verbose, "be verbose"),
119
120 OPT_GROUP("Commit message options"),
121 OPT_FILENAME('F', "file", &logfile, "read log from file"),
@@ -1048,7 +1048,7 @@ int cmd_status(int argc, const char **argv, const char *prefix)
1048 int fd;
1049 unsigned char sha1[20];
1050 static struct option builtin_status_options[] = {
1051 - OPT__VERBOSE(&verbose),
1051 + OPT__VERBOSE(&verbose, "be verbose"),
1052 OPT_SET_INT('s', "short", &status_format,
1053 "show status concisely", STATUS_FORMAT_SHORT),
1054 OPT_BOOLEAN('b', "branch", &status_show_branch,
builtin/count-objects.c
+1 -1
@@ -79,7 +79,7 @@ int cmd_count_objects(int argc, const char **argv, const char *prefix)
79 unsigned long loose = 0, packed = 0, packed_loose = 0, garbage = 0;
80 off_t loose_size = 0;
81 struct option opts[] = {
82 - OPT__VERBOSE(&verbose),
82 + OPT__VERBOSE(&verbose, "be verbose"),
83 OPT_END(),
84 };
85
builtin/fsck.c
+1 -1
@@ -572,7 +572,7 @@ static char const * const fsck_usage[] = {
572 };
573
574 static struct option fsck_opts[] = {
575 - OPT__VERBOSE(&verbose),
575 + OPT__VERBOSE(&verbose, "be verbose"),
576 OPT_BOOLEAN(0, "unreachable", &show_unreachable, "show unreachable objects"),
577 OPT_BOOLEAN(0, "tags", &show_tags, "report tags"),
578 OPT_BOOLEAN(0, "root", &show_root, "report root nodes"),
builtin/log.c
+1 -1
@@ -1365,7 +1365,7 @@ int cmd_cherry(int argc, const char **argv, const char *prefix)
1365
1366 struct option options[] = {
1367 OPT__ABBREV(&abbrev),
1368 - OPT__VERBOSE(&verbose),
1368 + OPT__VERBOSE(&verbose, "be verbose"),
1369 OPT_END()
1370 };
1371
builtin/notes.c
+1 -1
@@ -806,7 +806,7 @@ static int prune(int argc, const char **argv, const char *prefix)
806 struct option options[] = {
807 OPT_BOOLEAN('n', "dry-run", &show_only,
808 "do not remove, show only"),
809 - OPT_BOOLEAN('v', "verbose", &verbose, "report pruned notes"),
809 + OPT__VERBOSE(&verbose, "report pruned notes"),
810 OPT_END()
811 };
812
builtin/prune.c
+1 -1
@@ -127,7 +127,7 @@ int cmd_prune(int argc, const char **argv, const char *prefix)
127 const struct option options[] = {
128 OPT_BOOLEAN('n', "dry-run", &show_only,
129 "do not remove, show only"),
130 - OPT_BOOLEAN('v', "verbose", &verbose, "report pruned objects"),
130 + OPT__VERBOSE(&verbose, "report pruned objects"),
131 OPT_DATE(0, "expire", &expire,
132 "expire objects older than <time>"),
133 OPT_END()
builtin/read-tree.c
+1 -1
@@ -109,7 +109,7 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix)
109 PARSE_OPT_NONEG, index_output_cb },
110 OPT_SET_INT(0, "empty", &read_empty,
111 "only empty the index", 1),
112 - OPT__VERBOSE(&opts.verbose_update),
112 + OPT__VERBOSE(&opts.verbose_update, "be verbose"),
113 OPT_GROUP("Merging"),
114 OPT_SET_INT('m', NULL, &opts.merge,
115 "perform a merge in addition to a read", 1),
builtin/remote.c
+1 -1
@@ -1512,7 +1512,7 @@ static int show_all(void)
1512 int cmd_remote(int argc, const char **argv, const char *prefix)
1513 {
1514 struct option options[] = {
1515 - OPT_BOOLEAN('v', "verbose", &verbose, "be verbose; must be placed before a subcommand"),
1515 + OPT__VERBOSE(&verbose, "be verbose; must be placed before a subcommand"),
1516 OPT_END()
1517 };
1518 int result;
builtin/verify-tag.c
+1 -1
@@ -93,7 +93,7 @@ int cmd_verify_tag(int argc, const char **argv, const char *prefix)
93 {
94 int i = 1, verbose = 0, had_error = 0;
95 const struct option verify_tag_options[] = {
96 - OPT__VERBOSE(&verbose),
96 + OPT__VERBOSE(&verbose, "be verbose"),
97 OPT_END()
98 };
99
parse-options.h
+1 -1
@@ -198,7 +198,7 @@ extern int parse_opt_verbosity_cb(const struct option *, const char *, int);
198 extern int parse_opt_with_commit(const struct option *, const char *, int);
199 extern int parse_opt_tertiary(const struct option *, const char *, int);
200
201 -#define OPT__VERBOSE(var) OPT_BOOLEAN('v', "verbose", (var), "be verbose")
201 +#define OPT__VERBOSE(var, h) OPT_BOOLEAN('v', "verbose", (var), (h))
202 #define OPT__QUIET(var) OPT_BOOLEAN('q', "quiet", (var), "be quiet")
203 #define OPT__VERBOSITY(var) \
204 { OPTION_CALLBACK, 'v', "verbose", (var), NULL, "be more verbose", \
test-parse-options.c
+1 -1
@@ -66,7 +66,7 @@ int main(int argc, const char **argv)
66 "negative ambiguity", PARSE_OPT_NOARG | PARSE_OPT_NONEG },
67 OPT_GROUP("Standard options"),
68 OPT__ABBREV(&abbrev),
69 - OPT__VERBOSE(&verbose),
69 + OPT__VERBOSE(&verbose, "be verbose"),
70 OPT__DRY_RUN(&dry_run),
71 OPT__QUIET(&quiet),
72 OPT_END(),