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:

committed by
Junio C Hamano

parent
6bb2dc0b94
commit
3c7777672b
7
git.c
7
git.c
@ -60,6 +60,13 @@ static int list_cmds(const char *spec)
|
||||
list_all_main_cmds(&list);
|
||||
else if (match_token(spec, len, "others"))
|
||||
list_all_other_cmds(&list);
|
||||
else if (len > 5 && !strncmp(spec, "list-", 5)) {
|
||||
struct strbuf sb = STRBUF_INIT;
|
||||
|
||||
strbuf_add(&sb, spec + 5, len - 5);
|
||||
list_cmds_by_category(&list, sb.buf);
|
||||
strbuf_release(&sb);
|
||||
}
|
||||
else
|
||||
die(_("unsupported command listing type '%s'"), spec);
|
||||
spec += len;
|
||||
|
Reference in New Issue
Block a user