{"thread":{"id":"25676","subject":"[PATCH 1/7] add description parameter to OPT__VERBOSE","startedAt":"2010-11-08T17:56:39Z","lastAt":"2010-11-08T17:56:39Z","messageCount":1,"participants":["René Scharfe"],"isPatch":true,"patchVersion":1,"patchTotal":7},"messages":[{"id":"155395","messageId":"4CD839D7.8070403@lsrfire.ath.cx","threadId":"25676","inReplyTo":null,"subject":"[PATCH 1/7] add description parameter to OPT__VERBOSE","fromName":"René Scharfe","fromEmail":"rene.scharfe@lsrfire.ath.cx","sentAt":"2010-11-08T17:56:39Z","receivedAt":"2010-11-08T17:56:39Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"Allows better help text to be defined than \"be verbose\".  Also make use\nof the macro in places that already had a different description.  No\nobject code changes intended.\n\nSigned-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>\n---\n Documentation/technical/api-parse-options.txt |    2 +-\n archive.c                                     |    2 +-\n builtin/add.c                                 |    2 +-\n builtin/apply.c                               |    2 +-\n builtin/branch.c                              |    2 +-\n builtin/commit.c                              |    4 ++--\n builtin/count-objects.c                       |    2 +-\n builtin/fsck.c                                |    2 +-\n builtin/log.c                                 |    2 +-\n builtin/notes.c                               |    2 +-\n builtin/prune.c                               |    2 +-\n builtin/read-tree.c                           |    2 +-\n builtin/remote.c                              |    2 +-\n builtin/verify-tag.c                          |    2 +-\n parse-options.h                               |    2 +-\n test-parse-options.c                          |    2 +-\n 16 files changed, 17 insertions(+), 17 deletions(-)\n\ndiff --git a/Documentation/technical/api-parse-options.txt b/Documentation/technical/api-parse-options.txt\nindex c5d141c..969489b 100644\n--- a/Documentation/technical/api-parse-options.txt\n+++ b/Documentation/technical/api-parse-options.txt\n@@ -124,7 +124,7 @@ There are some macros to easily define options:\n `OPT__QUIET(&int_var)`::\n \tAdd `-q, \\--quiet`.\n \n-`OPT__VERBOSE(&int_var)`::\n+`OPT__VERBOSE(&int_var, description)`::\n \tAdd `-v, \\--verbose`.\n \n `OPT_GROUP(description)`::\ndiff --git a/archive.c b/archive.c\nindex f59afda..78a67f0 100644\n--- a/archive.c\n+++ b/archive.c\n@@ -314,7 +314,7 @@ static int parse_archive_args(int argc, const char **argv,\n \t\t\t\"write the archive to this file\"),\n \t\tOPT_BOOLEAN(0, \"worktree-attributes\", &worktree_attributes,\n \t\t\t\"read .gitattributes in working directory\"),\n-\t\tOPT__VERBOSE(&verbose),\n+\t\tOPT__VERBOSE(&verbose, \"be verbose\"),\n \t\tOPT__COMPR('0', &compression_level, \"store only\", 0),\n \t\tOPT__COMPR('1', &compression_level, \"compress faster\", 1),\n \t\tOPT__COMPR_HIDDEN('2', &compression_level, 2),\ndiff --git a/builtin/add.c b/builtin/add.c\nindex 56a4e0a..fbf1403 100644\n--- a/builtin/add.c\n+++ b/builtin/add.c\n@@ -314,7 +314,7 @@ static int ignore_add_errors, addremove, intent_to_add, ignore_missing = 0;\n \n static struct option builtin_add_options[] = {\n \tOPT__DRY_RUN(&show_only),\n-\tOPT__VERBOSE(&verbose),\n+\tOPT__VERBOSE(&verbose, \"be verbose\"),\n \tOPT_GROUP(\"\"),\n \tOPT_BOOLEAN('i', \"interactive\", &add_interactive, \"interactive picking\"),\n \tOPT_BOOLEAN('p', \"patch\", &patch_interactive, \"interactive patching\"),\ndiff --git a/builtin/apply.c b/builtin/apply.c\nindex 23c18c5..e1e9ecc 100644\n--- a/builtin/apply.c\n+++ b/builtin/apply.c\n@@ -3843,7 +3843,7 @@ int cmd_apply(int argc, const char **argv, const char *prefix_)\n \t\t\t\"don't expect at least one line of context\"),\n \t\tOPT_BOOLEAN(0, \"reject\", &apply_with_reject,\n \t\t\t\"leave the rejected hunks in corresponding *.rej files\"),\n-\t\tOPT__VERBOSE(&apply_verbosely),\n+\t\tOPT__VERBOSE(&apply_verbosely, \"be verbose\"),\n \t\tOPT_BIT(0, \"inaccurate-eof\", &options,\n \t\t\t\"tolerate incorrectly detected missing new-line at the end of file\",\n \t\t\tINACCURATE_EOF),\ndiff --git a/builtin/branch.c b/builtin/branch.c\nindex 87976f0..10788fc 100644\n--- a/builtin/branch.c\n+++ b/builtin/branch.c\n@@ -621,7 +621,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)\n \n \tstruct option options[] = {\n \t\tOPT_GROUP(\"Generic options\"),\n-\t\tOPT__VERBOSE(&verbose),\n+\t\tOPT__VERBOSE(&verbose, \"be verbose\"),\n \t\tOPT_SET_INT('t', \"track\",  &track, \"set up tracking mode (see git-pull(1))\",\n \t\t\tBRANCH_TRACK_EXPLICIT),\n \t\tOPT_SET_INT( 0, \"set-upstream\",  &track, \"change upstream info\",\ndiff --git a/builtin/commit.c b/builtin/commit.c\nindex 66fdd22..9cbc4ea 100644\n--- a/builtin/commit.c\n+++ b/builtin/commit.c\n@@ -115,7 +115,7 @@ static int opt_parse_m(const struct option *opt, const char *arg, int unset)\n \n static struct option builtin_commit_options[] = {\n \tOPT__QUIET(&quiet),\n-\tOPT__VERBOSE(&verbose),\n+\tOPT__VERBOSE(&verbose, \"be verbose\"),\n \n \tOPT_GROUP(\"Commit message options\"),\n \tOPT_FILENAME('F', \"file\", &logfile, \"read log from file\"),\n@@ -1048,7 +1048,7 @@ int cmd_status(int argc, const char **argv, const char *prefix)\n \tint fd;\n \tunsigned char sha1[20];\n \tstatic struct option builtin_status_options[] = {\n-\t\tOPT__VERBOSE(&verbose),\n+\t\tOPT__VERBOSE(&verbose, \"be verbose\"),\n \t\tOPT_SET_INT('s', \"short\", &status_format,\n \t\t\t    \"show status concisely\", STATUS_FORMAT_SHORT),\n \t\tOPT_BOOLEAN('b', \"branch\", &status_show_branch,\ndiff --git a/builtin/count-objects.c b/builtin/count-objects.c\nindex 2bdd8eb..c37cb98 100644\n--- a/builtin/count-objects.c\n+++ b/builtin/count-objects.c\n@@ -79,7 +79,7 @@ int cmd_count_objects(int argc, const char **argv, const char *prefix)\n \tunsigned long loose = 0, packed = 0, packed_loose = 0, garbage = 0;\n \toff_t loose_size = 0;\n \tstruct option opts[] = {\n-\t\tOPT__VERBOSE(&verbose),\n+\t\tOPT__VERBOSE(&verbose, \"be verbose\"),\n \t\tOPT_END(),\n \t};\n \ndiff --git a/builtin/fsck.c b/builtin/fsck.c\nindex 0929c7f..6d5ebca 100644\n--- a/builtin/fsck.c\n+++ b/builtin/fsck.c\n@@ -572,7 +572,7 @@ static char const * const fsck_usage[] = {\n };\n \n static struct option fsck_opts[] = {\n-\tOPT__VERBOSE(&verbose),\n+\tOPT__VERBOSE(&verbose, \"be verbose\"),\n \tOPT_BOOLEAN(0, \"unreachable\", &show_unreachable, \"show unreachable objects\"),\n \tOPT_BOOLEAN(0, \"tags\", &show_tags, \"report tags\"),\n \tOPT_BOOLEAN(0, \"root\", &show_root, \"report root nodes\"),\ndiff --git a/builtin/log.c b/builtin/log.c\nindex 22d1290..d0297a1 100644\n--- a/builtin/log.c\n+++ b/builtin/log.c\n@@ -1365,7 +1365,7 @@ int cmd_cherry(int argc, const char **argv, const char *prefix)\n \n \tstruct option options[] = {\n \t\tOPT__ABBREV(&abbrev),\n-\t\tOPT__VERBOSE(&verbose),\n+\t\tOPT__VERBOSE(&verbose, \"be verbose\"),\n \t\tOPT_END()\n \t};\n \ndiff --git a/builtin/notes.c b/builtin/notes.c\nindex 6d07aac..e0a1f62 100644\n--- a/builtin/notes.c\n+++ b/builtin/notes.c\n@@ -806,7 +806,7 @@ static int prune(int argc, const char **argv, const char *prefix)\n \tstruct option options[] = {\n \t\tOPT_BOOLEAN('n', \"dry-run\", &show_only,\n \t\t\t    \"do not remove, show only\"),\n-\t\tOPT_BOOLEAN('v', \"verbose\", &verbose, \"report pruned notes\"),\n+\t\tOPT__VERBOSE(&verbose, \"report pruned notes\"),\n \t\tOPT_END()\n \t};\n \ndiff --git a/builtin/prune.c b/builtin/prune.c\nindex 99218ba..8b770af 100644\n--- a/builtin/prune.c\n+++ b/builtin/prune.c\n@@ -127,7 +127,7 @@ int cmd_prune(int argc, const char **argv, const char *prefix)\n \tconst struct option options[] = {\n \t\tOPT_BOOLEAN('n', \"dry-run\", &show_only,\n \t\t\t    \"do not remove, show only\"),\n-\t\tOPT_BOOLEAN('v', \"verbose\", &verbose, \"report pruned objects\"),\n+\t\tOPT__VERBOSE(&verbose, \"report pruned objects\"),\n \t\tOPT_DATE(0, \"expire\", &expire,\n \t\t\t \"expire objects older than <time>\"),\n \t\tOPT_END()\ndiff --git a/builtin/read-tree.c b/builtin/read-tree.c\nindex eb1e3e7..73c89ed 100644\n--- a/builtin/read-tree.c\n+++ b/builtin/read-tree.c\n@@ -109,7 +109,7 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix)\n \t\t  PARSE_OPT_NONEG, index_output_cb },\n \t\tOPT_SET_INT(0, \"empty\", &read_empty,\n \t\t\t    \"only empty the index\", 1),\n-\t\tOPT__VERBOSE(&opts.verbose_update),\n+\t\tOPT__VERBOSE(&opts.verbose_update, \"be verbose\"),\n \t\tOPT_GROUP(\"Merging\"),\n \t\tOPT_SET_INT('m', NULL, &opts.merge,\n \t\t\t    \"perform a merge in addition to a read\", 1),\ndiff --git a/builtin/remote.c b/builtin/remote.c\nindex e9a6e09..b944b91 100644\n--- a/builtin/remote.c\n+++ b/builtin/remote.c\n@@ -1512,7 +1512,7 @@ static int show_all(void)\n int cmd_remote(int argc, const char **argv, const char *prefix)\n {\n \tstruct option options[] = {\n-\t\tOPT_BOOLEAN('v', \"verbose\", &verbose, \"be verbose; must be placed before a subcommand\"),\n+\t\tOPT__VERBOSE(&verbose, \"be verbose; must be placed before a subcommand\"),\n \t\tOPT_END()\n \t};\n \tint result;\ndiff --git a/builtin/verify-tag.c b/builtin/verify-tag.c\nindex 9f482c2..6784846 100644\n--- a/builtin/verify-tag.c\n+++ b/builtin/verify-tag.c\n@@ -93,7 +93,7 @@ int cmd_verify_tag(int argc, const char **argv, const char *prefix)\n {\n \tint i = 1, verbose = 0, had_error = 0;\n \tconst struct option verify_tag_options[] = {\n-\t\tOPT__VERBOSE(&verbose),\n+\t\tOPT__VERBOSE(&verbose, \"be verbose\"),\n \t\tOPT_END()\n \t};\n \ndiff --git a/parse-options.h b/parse-options.h\nindex d982f0f..14918b1 100644\n--- a/parse-options.h\n+++ b/parse-options.h\n@@ -198,7 +198,7 @@ extern int parse_opt_verbosity_cb(const struct option *, const char *, int);\n extern int parse_opt_with_commit(const struct option *, const char *, int);\n extern int parse_opt_tertiary(const struct option *, const char *, int);\n \n-#define OPT__VERBOSE(var)  OPT_BOOLEAN('v', \"verbose\", (var), \"be verbose\")\n+#define OPT__VERBOSE(var, h)  OPT_BOOLEAN('v', \"verbose\", (var), (h))\n #define OPT__QUIET(var)    OPT_BOOLEAN('q', \"quiet\",   (var), \"be quiet\")\n #define OPT__VERBOSITY(var) \\\n \t{ OPTION_CALLBACK, 'v', \"verbose\", (var), NULL, \"be more verbose\", \\\ndiff --git a/test-parse-options.c b/test-parse-options.c\nindex acd1a2b..bd7b8a4 100644\n--- a/test-parse-options.c\n+++ b/test-parse-options.c\n@@ -66,7 +66,7 @@ int main(int argc, const char **argv)\n \t\t  \"negative ambiguity\", PARSE_OPT_NOARG | PARSE_OPT_NONEG },\n \t\tOPT_GROUP(\"Standard options\"),\n \t\tOPT__ABBREV(&abbrev),\n-\t\tOPT__VERBOSE(&verbose),\n+\t\tOPT__VERBOSE(&verbose, \"be verbose\"),\n \t\tOPT__DRY_RUN(&dry_run),\n \t\tOPT__QUIET(&quiet),\n \t\tOPT_END(),\n-- \n1.7.3\n"}]}