aboutsummaryrefslogtreecommitdiff
path: root/help.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2021-10-13 15:15:58 -0700
committerJunio C Hamano <gitster@pobox.com>2021-10-13 15:15:58 -0700
commit62f035aee3ff53aa9c5296d5acb4c4b683ba314d (patch)
tree8b2ff32deb4922a1468a672b68ecf2284fc09899 /help.c
parentaf303ee39214a04ad3c01e5924f2e8c09b5c18cb (diff)
parent06fa4db3f7e450deb0bb849b338d7a5453f0d183 (diff)
downloadgit-62f035aee3ff53aa9c5296d5acb4c4b683ba314d.tar.xz
Merge branch 'ab/help-config-vars'
Teach "git help -c" into helping the command line completion of configuration variables. * ab/help-config-vars: help: move column config discovery to help.c library help / completion: make "git help" do the hard work help tests: test --config-for-completion option & output help: simplify by moving to OPT_CMDMODE() help: correct logic error in combining --all and --guides help: correct logic error in combining --all and --config help tests: add test for --config output help: correct usage & behavior of "git help --guides" help: correct the usage string in -h and documentation
Diffstat (limited to 'help.c')
-rw-r--r--help.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/help.c b/help.c
index be2fa64241..973e47cdc3 100644
--- a/help.c
+++ b/help.c
@@ -293,9 +293,21 @@ void load_command_list(const char *prefix,
exclude_cmds(other_cmds, main_cmds);
}
-void list_commands(unsigned int colopts,
- struct cmdnames *main_cmds, struct cmdnames *other_cmds)
+static int get_colopts(const char *var, const char *value, void *data)
{
+ unsigned int *colopts = data;
+
+ if (starts_with(var, "column."))
+ return git_column_config(var, value, "help", colopts);
+
+ return 0;
+}
+
+void list_commands(struct cmdnames *main_cmds, struct cmdnames *other_cmds)
+{
+ unsigned int colopts = 0;
+ git_config(get_colopts, &colopts);
+
if (main_cmds->cnt) {
const char *exec_path = git_exec_path();
printf_ln(_("available git commands in '%s'"), exec_path);