diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2018-05-26 15:55:24 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-05-29 07:51:28 +0200 |
commit | 3ac68a93fd2b984e2a7e570217d2646a208ffcc3 (patch) | |
tree | a2daa2ec0763d187815899c677681ff7ccb6acf8 /fsck.c | |
parent | fsck: factor out msg_id_info[] lazy initialization code (diff) | |
download | git-3ac68a93fd2b984e2a7e570217d2646a208ffcc3.tar.xz git-3ac68a93fd2b984e2a7e570217d2646a208ffcc3.zip |
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 <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'fsck.c')
-rw-r--r-- | fsck.c | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -10,6 +10,7 @@ #include "utf8.h" #include "sha1-array.h" #include "decorate.h" +#include "help.h" #define FSCK_FATAL -1 #define FSCK_INFO -2 @@ -120,6 +121,17 @@ static int parse_msg_id(const char *text) return -1; } +void list_config_fsck_msg_ids(struct string_list *list, const char *prefix) +{ + int i; + + prepare_msg_ids(); + + /* TODO: we can do better by producing camelCase names */ + for (i = 0; i < FSCK_MSG_MAX; i++) + list_config_item(list, prefix, msg_id_info[i].downcased); +} + static int fsck_msg_type(enum fsck_msg_id msg_id, struct fsck_options *options) { |