From 3ac68a93fd2b984e2a7e570217d2646a208ffcc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Sat, 26 May 2018 15:55:24 +0200 Subject: help: add --config to list all available config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sometimes it helps to list all available config vars so the user can search for something they want. The config man page can also be used but it's harder to search if you want to focus on the variable name, for example. This is not the best way to collect the available config since it's not precise. Ideally we should have a centralized list of config in C code (pretty much like 'struct option'), but that's a lot more work. This will do for now. Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- advice.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'advice.c') diff --git a/advice.c b/advice.c index 370a56d054..cf6c673ed7 100644 --- a/advice.c +++ b/advice.c @@ -1,6 +1,7 @@ #include "cache.h" #include "config.h" #include "color.h" +#include "help.h" int advice_push_update_rejected = 1; int advice_push_non_ff_current = 1; @@ -131,6 +132,14 @@ int git_default_advice_config(const char *var, const char *value) return 0; } +void list_config_advices(struct string_list *list, const char *prefix) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(advice_config); i++) + list_config_item(list, prefix, advice_config[i].name); +} + int error_resolve_conflict(const char *me) { if (!strcmp(me, "cherry-pick")) -- cgit v1.2.3