]> git.ipfire.org Git - thirdparty/git.git/blame - generate-cmdlist.sh
is_ntfs_dotgit(): only verify the leading segment
[thirdparty/git.git] / generate-cmdlist.sh
CommitLineData
82aec45b
ES
1#!/bin/sh
2
3echo "/* Automatically generated by $0 */
4struct cmdname_help {
5 char name[16];
6 char help[80];
7 unsigned char group;
8};
9
10static const char *common_cmd_groups[] = {"
11
12grps=grps$$.tmp
13match=match$$.tmp
14trap "rm -f '$grps' '$match'" 0 1 2 3 15
15
16sed -n '
17 1,/^### common groups/b
18 /^### command list/q
19 /^#/b
20 /^[ ]*$/b
21 h;s/^[^ ][^ ]*[ ][ ]*\(.*\)/ N_("\1"),/p
22 g;s/^\([^ ][^ ]*\)[ ].*/\1/w '$grps'
23 ' "$1"
24printf '};\n\n'
25
26n=0
27substnum=
28while read grp
29do
30 echo "^git-..*[ ]$grp"
31 substnum="$substnum${substnum:+;}s/[ ]$grp/$n/"
32 n=$(($n+1))
33done <"$grps" >"$match"
34
35printf 'static struct cmdname_help common_cmds[] = {\n'
36grep -f "$match" "$1" |
37sed 's/^git-//' |
38sort |
39while read cmd tags
40do
41 tag=$(echo "$tags" | sed "$substnum; s/[^0-9]//g")
42 sed -n '
43 /^NAME/,/git-'"$cmd"'/H
44 ${
45 x
46 s/.*git-'"$cmd"' - \(.*\)/ {"'"$cmd"'", N_("\1"), '$tag'},/
47 p
48 }' "Documentation/git-$cmd.txt"
49done
50echo "};"