summaryrefslogtreecommitdiff
path: root/generate-cmdlist.sh
diff options
context:
space:
mode:
authorLibravatar Nguyễn Thái Ngọc Duy <pclouds@gmail.com>2018-05-10 10:46:40 +0200
committerLibravatar Junio C Hamano <gitster@pobox.com>2018-05-10 19:52:47 +0900
commit75ba897e3059da44ad0cf27d1e4d12dc03e54001 (patch)
tree40685b7592cbc4373949b1a91d37553cdef6f108 /generate-cmdlist.sh
parentMerge branch 'svn/authors-prog-2' of git://bogomips.org/git-svn (diff)
downloadtgif-75ba897e3059da44ad0cf27d1e4d12dc03e54001.tar.xz
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>
Diffstat (limited to 'generate-cmdlist.sh')
-rwxr-xr-xgenerate-cmdlist.sh18
1 files changed, 11 insertions, 7 deletions
diff --git a/generate-cmdlist.sh b/generate-cmdlist.sh
index eeea4b67ea..31b6d886cb 100755
--- a/generate-cmdlist.sh
+++ b/generate-cmdlist.sh
@@ -1,5 +1,15 @@
#!/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 */
struct cmdname_help {
char name[16];
@@ -39,12 +49,6 @@ sort |
while read cmd tags
do
tag=$(echo "$tags" | sed "$substnum; s/[^0-9]//g")
- sed -n '
- /^NAME/,/git-'"$cmd"'/H
- ${
- x
- s/.*git-'"$cmd"' - \(.*\)/ {"'"$cmd"'", N_("\1"), '$tag'},/
- p
- }' "Documentation/git-$cmd.txt"
+ echo " {\"$cmd\", $(get_synopsis git-$cmd), $tag},"
done
echo "};"