path: root/grep.c
diff options
authorNguyễn Thái Ngọc Duy <>2018-05-26 13:55:24 (GMT)
committerJunio C Hamano <>2018-05-29 05:51:28 (GMT)
commit3ac68a93fd2b984e2a7e570217d2646a208ffcc3 (patch)
treea2daa2ec0763d187815899c677681ff7ccb6acf8 /grep.c
parenta46baac61ebc6a8b187f76bcd49b625e0d4f408e (diff)
help: add --config to list all available config
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 <>
Diffstat (limited to 'grep.c')
1 files changed, 3 insertions, 0 deletions
diff --git a/grep.c b/grep.c
index b7012f4..bf71b13 100644
--- a/grep.c
+++ b/grep.c
@@ -7,6 +7,7 @@
#include "diffcore.h"
#include "commit.h"
#include "quote.h"
+#include "help.h"
static int grep_source_load(struct grep_source *gs);
static int grep_source_is_binary(struct grep_source *gs);
@@ -80,6 +81,8 @@ static int parse_pattern_type_arg(const char *opt, const char *arg)
die("bad %s argument: %s", opt, arg);
+define_list_config_array_extra(color_grep_slots, {"match"});
* Read the configuration file once and store it in
* the grep_defaults template.