summaryrefslogtreecommitdiff
path: root/builtin/help.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2018-05-26 13:55:28 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-05-29 05:51:28 (GMT)
commite17ca926371dc96967f556f41c18410eea8c7d32 (patch)
treef02e9bc9f6c9b7e6fe8f55a702e802e469abfaba /builtin/help.c
parent431bb23a271ef45e22ad4a2def2e0ba0a1954e98 (diff)
downloadgit-e17ca926371dc96967f556f41c18410eea8c7d32.zip
git-e17ca926371dc96967f556f41c18410eea8c7d32.tar.gz
git-e17ca926371dc96967f556f41c18410eea8c7d32.tar.bz2
completion: drop the hard coded list of config vars
The new help option --config-for-completion is a machine friendlier version of --config where all the placeholders and wildcards are dropped, leaving only the good, completable prefixes for git-completion.bash to consume. 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 'builtin/help.c')
-rw-r--r--builtin/help.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/builtin/help.c b/builtin/help.c
index ccb206e..8d4f6dd 100644
--- a/builtin/help.c
+++ b/builtin/help.c
@@ -47,6 +47,7 @@ static struct option builtin_help_options[] = {
OPT_HIDDEN_BOOL(0, "exclude-guides", &exclude_guides, N_("exclude guides")),
OPT_BOOL('g', "guides", &show_guides, N_("print list of useful guides")),
OPT_BOOL('c', "config", &show_config, N_("print all configuration variable names")),
+ OPT_SET_INT_F(0, "config-for-completion", &show_config, "", 2, PARSE_OPT_HIDDEN),
OPT_SET_INT('m', "man", &help_format, N_("show man page"), HELP_FORMAT_MAN),
OPT_SET_INT('w', "web", &help_format, N_("show manual in web browser"),
HELP_FORMAT_WEB),
@@ -447,8 +448,14 @@ int cmd_help(int argc, const char **argv, const char *prefix)
}
if (show_config) {
+ int for_human = show_config == 1;
+
+ if (!for_human) {
+ list_config_help(for_human);
+ return 0;
+ }
setup_pager();
- list_config_help();
+ list_config_help(for_human);
printf("\n%s\n", _("'git help config' for more information"));
return 0;
}