summaryrefslogtreecommitdiffstats
path: root/generate-cmdlist.sh
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2018-05-20 20:40:00 +0200
committerJunio C Hamano <gitster@pobox.com>2018-05-21 06:23:14 +0200
commit3c7777672bf9bc9ac2ddb422633b39af4faa1682 (patch)
tree13710eec966e2da6bde01cde29e5412bcb808289 /generate-cmdlist.sh
parentcompletion: implement and use --list-cmds=main,others (diff)
downloadgit-3c7777672bf9bc9ac2ddb422633b39af4faa1682.tar.xz
git-3c7777672bf9bc9ac2ddb422633b39af4faa1682.zip
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 'generate-cmdlist.sh')
-rwxr-xr-xgenerate-cmdlist.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/generate-cmdlist.sh b/generate-cmdlist.sh
index 3bcc1ee57d..8d6d8b45ce 100755
--- a/generate-cmdlist.sh
+++ b/generate-cmdlist.sh
@@ -45,6 +45,21 @@ define_categories () {
test "$bit" -gt 32 && die "Urgh.. too many categories?"
}
+define_category_names () {
+ echo
+ echo "/* Category names */"
+ echo "static const char *category_names[] = {"
+ bit=0
+ category_list "$1" |
+ while read cat
+ do
+ echo " \"$cat\", /* (1UL << $bit) */"
+ bit=$(($bit+1))
+ done
+ echo " NULL"
+ echo "};"
+}
+
print_command_list () {
echo "static struct cmdname_help command_list[] = {"
@@ -70,4 +85,6 @@ struct cmdname_help {
"
define_categories "$1"
echo
+define_category_names "$1"
+echo
print_command_list "$1"