summaryrefslogtreecommitdiff
path: root/git.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2018-05-20 18:40:00 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-05-21 04:23:14 (GMT)
commit3c7777672bf9bc9ac2ddb422633b39af4faa1682 (patch)
tree13710eec966e2da6bde01cde29e5412bcb808289 /git.c
parent6bb2dc0b9472a84c7d17ee93bda28a7c1c97d415 (diff)
downloadgit-3c7777672bf9bc9ac2ddb422633b39af4faa1682.zip
git-3c7777672bf9bc9ac2ddb422633b39af4faa1682.tar.gz
git-3c7777672bf9bc9ac2ddb422633b39af4faa1682.tar.bz2
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>
Diffstat (limited to 'git.c')
-rw-r--r--git.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/git.c b/git.c
index 10907f7..4d5b8a9 100644
--- a/git.c
+++ b/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;