generate-cmds.sh: factor out synopsis extract code
This makes it easier to reuse the same code in another place (very soon). Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>maint
parent
fe0a9eaf31
commit
75ba897e30
|
@ -1,5 +1,15 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
get_synopsis () {
|
||||||
|
sed -n '
|
||||||
|
/^NAME/,/'"$1"'/H
|
||||||
|
${
|
||||||
|
x
|
||||||
|
s/.*'"$1"' - \(.*\)/N_("\1")/
|
||||||
|
p
|
||||||
|
}' "Documentation/$1.txt"
|
||||||
|
}
|
||||||
|
|
||||||
echo "/* Automatically generated by generate-cmdlist.sh */
|
echo "/* Automatically generated by generate-cmdlist.sh */
|
||||||
struct cmdname_help {
|
struct cmdname_help {
|
||||||
char name[16];
|
char name[16];
|
||||||
|
@ -39,12 +49,6 @@ sort |
|
||||||
while read cmd tags
|
while read cmd tags
|
||||||
do
|
do
|
||||||
tag=$(echo "$tags" | sed "$substnum; s/[^0-9]//g")
|
tag=$(echo "$tags" | sed "$substnum; s/[^0-9]//g")
|
||||||
sed -n '
|
echo " {\"$cmd\", $(get_synopsis git-$cmd), $tag},"
|
||||||
/^NAME/,/git-'"$cmd"'/H
|
|
||||||
${
|
|
||||||
x
|
|
||||||
s/.*git-'"$cmd"' - \(.*\)/ {"'"$cmd"'", N_("\1"), '$tag'},/
|
|
||||||
p
|
|
||||||
}' "Documentation/git-$cmd.txt"
|
|
||||||
done
|
done
|
||||||
echo "};"
|
echo "};"
|
||||||
|
|
Loading…
Reference in New Issue