summaryrefslogtreecommitdiff
path: root/parse-options.h
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2018-02-09 11:01:40 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-02-09 18:24:49 (GMT)
commitb9d7f4b4dbebea34ca8d02be8889884fc3fb90c7 (patch)
treeae3333a0252d28013a8494f35db91db26d8a567c /parse-options.h
parent5be1f00a9a701532232f57958efab4be8c959a29 (diff)
downloadgit-b9d7f4b4dbebea34ca8d02be8889884fc3fb90c7.zip
git-b9d7f4b4dbebea34ca8d02be8889884fc3fb90c7.tar.gz
git-b9d7f4b4dbebea34ca8d02be8889884fc3fb90c7.tar.bz2
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.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/parse-options.h b/parse-options.h
index af71122..a5caa0b 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