diff options
author | Pierre Habouzit <madcoder@debian.org> | 2007-10-14 11:05:12 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2007-10-29 21:03:30 -0700 |
commit | 0ce865b134f8ccd60f6e584744144b0978a9fdf2 (patch) | |
tree | 0a3d70424a322ea6302dbb5a522561eebb434dcd /parse-options.h | |
parent | ffe659f94d793375fca97dd296422fc10c155016 (diff) | |
download | git-0ce865b134f8ccd60f6e584744144b0978a9fdf2.tar.gz |
Add shortcuts for very often used options.
It helps with consistency of the help strings, for example.
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'parse-options.h')
-rw-r--r-- | parse-options.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/parse-options.h b/parse-options.h index 2b8e7624d6..2558e00a7c 100644 --- a/parse-options.h +++ b/parse-options.h @@ -55,4 +55,15 @@ extern int parse_options(int argc, const char **argv, extern NORETURN void usage_with_options(const char * const *usagestr, const struct option *options); +/*----- some often used options -----*/ +extern int parse_opt_abbrev_cb(const struct option *, const char *, int); + +#define OPT__VERBOSE(var) OPT_BOOLEAN('v', "verbose", (var), "be verbose") +#define OPT__QUIET(var) OPT_BOOLEAN('q', "quiet", (var), "be quiet") +#define OPT__DRY_RUN(var) OPT_BOOLEAN('n', "dry-run", (var), "dry run") +#define OPT__ABBREV(var) \ + { OPTION_CALLBACK, 0, "abbrev", (var), "n", \ + "use <n> digits to display SHA-1s", \ + PARSE_OPT_OPTARG, &parse_opt_abbrev_cb, 0 } + #endif |