diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2018-02-09 18:01:40 +0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-02-09 10:24:49 -0800 |
commit | b9d7f4b4dbebea34ca8d02be8889884fc3fb90c7 (patch) | |
tree | ae3333a0252d28013a8494f35db91db26d8a567c /parse-options.h | |
parent | 5be1f00a9a701532232f57958efab4be8c959a29 (diff) | |
download | git-b9d7f4b4dbebea34ca8d02be8889884fc3fb90c7.tar.gz |
parse-options: support --git-completion-helper
This option is designed to be used by git-completion.bash. For many
simple cases, what we do in there is usually
__gitcomp "lots of completion options"
which has to be manually updated when a new user-visible option is
added. With support from parse-options, we can write
__gitcomp "$(git command --git-completion-helper)"
and get that list directly from the parser for free. Dangerous/Unpopular
options could be hidden with the new "NOCOMPLETE" flag.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'parse-options.h')
-rw-r--r-- | parse-options.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/parse-options.h b/parse-options.h index af711227ae..a5caa0bb1d 100644 --- a/parse-options.h +++ b/parse-options.h @@ -38,7 +38,8 @@ enum parse_opt_option_flags { PARSE_OPT_LASTARG_DEFAULT = 16, PARSE_OPT_NODASH = 32, PARSE_OPT_LITERAL_ARGHELP = 64, - PARSE_OPT_SHELL_EVAL = 256 + PARSE_OPT_SHELL_EVAL = 256, + PARSE_OPT_NOCOMPLETE = 512 }; struct option; @@ -89,6 +90,8 @@ typedef int parse_opt_ll_cb(struct parse_opt_ctx_t *ctx, * PARSE_OPT_LITERAL_ARGHELP: says that argh shouldn't be enclosed in brackets * (i.e. '<argh>') in the help message. * Useful for options with multiple parameters. + * PARSE_OPT_NOCOMPLETE: by default all visible options are completable + * by git-completion.bash. This option suppresses that. * * `callback`:: * pointer to the callback to use for OPTION_CALLBACK or |