git: support --list-cmds=list-<category>

This allows us to select any group of commands by a category defined
in command-list.txt. This is an internal/hidden option so we don't
have to be picky about the category name or worried about exposing too
much.

This will be used later by git-completion.bash to retrieve certain
command groups.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Nguyễn Thái Ngọc Duy
2018-05-20 20:40:00 +02:00
committed by Junio C Hamano
parent 6bb2dc0b94
commit 3c7777672b
5 changed files with 51 additions and 1 deletions

2
help.h
View File

@ -21,6 +21,8 @@ static inline void mput_char(char c, unsigned int num)
extern void list_common_cmds_help(void);
extern void list_all_main_cmds(struct string_list *list);
extern void list_all_other_cmds(struct string_list *list);
extern void list_cmds_by_category(struct string_list *list,
const char *category);
extern const char *help_unknown_cmd(const char *cmd);
extern void load_command_list(const char *prefix,
struct cmdnames *main_cmds,