add description parameter to OPT__QUIET
Allows better help text to be defined than "be quiet". Also make use of the macro in a place 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 19:06 UTC
d52ee6e6131f65bb4360743ebea2e7b400b544e4
14 files changed
+15
-15
Documentation/technical/api-parse-options.txt
+1
-1
@@ -121,7 +121,7 @@ There are some macros to easily define options:
121
`OPT__DRY_RUN(&int_var, description)`::
122
Add `-n, \--dry-run`.
123
124
-`OPT__QUIET(&int_var)`::
124
+`OPT__QUIET(&int_var, description)`::
125
Add `-q, \--quiet`.
126
127
`OPT__VERBOSE(&int_var, description)`::
builtin/checkout-index.c
+1
-1
@@ -219,7 +219,7 @@ int cmd_checkout_index(int argc, const char **argv, const char *prefix)
219
"checks out all files in the index"),
220
OPT_BOOLEAN('f', "force", &force,
221
"forces overwrite of existing files"),
222
- OPT__QUIET(&quiet),
222
+ OPT__QUIET(&quiet, "be quiet"),
223
OPT_BOOLEAN('n', "no-create", ¬_new,
224
"don't checkout new files"),
225
{ OPTION_CALLBACK, 'u', "index", &newfd, NULL,
builtin/checkout.c
+1
-1
@@ -686,7 +686,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
686
int patch_mode = 0;
687
int dwim_new_local_branch = 1;
688
struct option options[] = {
689
- OPT__QUIET(&opts.quiet),
689
+ OPT__QUIET(&opts.quiet, "be quiet"),
690
OPT_STRING('b', NULL, &opts.new_branch, "branch",
691
"create and checkout a new branch"),
692
OPT_STRING('B', NULL, &opts.new_branch_force, "branch",
builtin/clean.c
+1
-1
@@ -48,7 +48,7 @@ int cmd_clean(int argc, const char **argv, const char *prefix)
48
const char *qname;
49
char *seen = NULL;
50
struct option options[] = {
51
- OPT__QUIET(&quiet),
51
+ OPT__QUIET(&quiet, "be quiet"),
52
OPT__DRY_RUN(&show_only, "dry run"),
53
OPT_BOOLEAN('f', "force", &force, "force"),
54
OPT_BOOLEAN('d', NULL, &remove_directories,
builtin/commit.c
+1
-1
@@ -114,7 +114,7 @@ static int opt_parse_m(const struct option *opt, const char *arg, int unset)
114
}
115
116
static struct option builtin_commit_options[] = {
117
- OPT__QUIET(&quiet),
117
+ OPT__QUIET(&quiet, "be quiet"),
118
OPT__VERBOSE(&verbose, "be verbose"),
119
120
OPT_GROUP("Commit message options"),
builtin/gc.c
+1
-1
@@ -180,7 +180,7 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
180
char buf[80];
181
182
struct option builtin_gc_options[] = {
183
- OPT__QUIET(&quiet),
183
+ OPT__QUIET(&quiet, "be quiet"),
184
{ OPTION_STRING, 0, "prune", &prune_expire, "date",
185
"prune unreferenced objects",
186
PARSE_OPT_OPTARG, NULL, (intptr_t)prune_expire },
builtin/grep.c
+2
-2
@@ -915,8 +915,8 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
915
{ OPTION_CALLBACK, ')', NULL, &opt, NULL, "",
916
PARSE_OPT_NOARG | PARSE_OPT_NONEG | PARSE_OPT_NODASH,
917
close_callback },
918
- OPT_BOOLEAN('q', "quiet", &opt.status_only,
919
- "indicate hit with exit status without output"),
918
+ OPT__QUIET(&opt.status_only,
919
+ "indicate hit with exit status without output"),
920
OPT_BOOLEAN(0, "all-match", &opt.all_match,
921
"show only matches from files that match all patterns"),
922
OPT_GROUP(""),
builtin/merge-file.c
+1
-1
@@ -39,7 +39,7 @@ int cmd_merge_file(int argc, const char **argv, const char *prefix)
39
XDL_MERGE_FAVOR_UNION),
40
OPT_INTEGER(0, "marker-size", &xmp.marker_size,
41
"for conflicts, use this marker size"),
42
- OPT__QUIET(&quiet),
42
+ OPT__QUIET(&quiet, "be quiet"),
43
OPT_CALLBACK('L', NULL, names, "name",
44
"set labels for file1/orig_file/file2", &label_cb),
45
OPT_END(),
builtin/reset.c
+1
-1
@@ -243,7 +243,7 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
243
struct commit *commit;
244
char *reflog_action, msg[1024];
245
const struct option options[] = {
246
- OPT__QUIET(&quiet),
246
+ OPT__QUIET(&quiet, "be quiet"),
247
OPT_SET_INT(0, "mixed", &reset_type,
248
"reset HEAD and index", MIXED),
249
OPT_SET_INT(0, "soft", &reset_type, "reset only HEAD", SOFT),
builtin/rm.c
+1
-1
@@ -140,7 +140,7 @@ static int ignore_unmatch = 0;
140
141
static struct option builtin_rm_options[] = {
142
OPT__DRY_RUN(&show_only, "dry run"),
143
- OPT__QUIET(&quiet),
143
+ OPT__QUIET(&quiet, "be quiet"),
144
OPT_BOOLEAN( 0 , "cached", &index_only, "only remove from the index"),
145
OPT_BOOLEAN('f', "force", &force, "override the up-to-date check"),
146
OPT_BOOLEAN('r', NULL, &recursive, "allow recursive removal"),
builtin/show-ref.c
+1
-1
@@ -193,7 +193,7 @@ static const struct option show_ref_options[] = {
193
"only show SHA1 hash using <n> digits",
194
PARSE_OPT_OPTARG, &hash_callback },
195
OPT__ABBREV(&abbrev),
196
- OPT__QUIET(&quiet),
196
+ OPT__QUIET(&quiet, "be quiet"),
197
{ OPTION_CALLBACK, 0, "exclude-existing", &exclude_existing_arg,
198
"pattern", "show refs from stdin that aren't in local repository",
199
PARSE_OPT_OPTARG | PARSE_OPT_NONEG, exclude_existing_callback },
builtin/symbolic-ref.c
+1
-1
@@ -30,7 +30,7 @@ int cmd_symbolic_ref(int argc, const char **argv, const char *prefix)
30
int quiet = 0;
31
const char *msg = NULL;
32
struct option options[] = {
33
- OPT__QUIET(&quiet),
33
+ OPT__QUIET(&quiet, "be quiet"),
34
OPT_STRING('m', NULL, &msg, "reason", "reason of the update"),
35
OPT_END(),
36
};
parse-options.h
+1
-1
@@ -199,7 +199,7 @@ 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, h) OPT_BOOLEAN('v', "verbose", (var), (h))
202
-#define OPT__QUIET(var) OPT_BOOLEAN('q', "quiet", (var), "be quiet")
202
+#define OPT__QUIET(var, h) OPT_BOOLEAN('q', "quiet", (var), (h))
203
#define OPT__VERBOSITY(var) \
204
{ OPTION_CALLBACK, 'v', "verbose", (var), NULL, "be more verbose", \
205
PARSE_OPT_NOARG, &parse_opt_verbosity_cb, 0 }, \
test-parse-options.c
+1
-1
@@ -68,7 +68,7 @@ int main(int argc, const char **argv)
68
OPT__ABBREV(&abbrev),
69
OPT__VERBOSE(&verbose, "be verbose"),
70
OPT__DRY_RUN(&dry_run, "dry run"),
71
- OPT__QUIET(&quiet),
71
+ OPT__QUIET(&quiet, "be quiet"),
72
OPT_END(),
73
};
74
int i;