Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
generate-cmds.sh: factor out synopsis extract code
author
Nguyễn Thái Ngọc Duy
<pclouds@gmail.com>
Thu, 10 May 2018 08:46:40 +0000
(10:46 +0200)
committer
Junio C Hamano
<gitster@pobox.com>
Thu, 10 May 2018 10:52:47 +0000
(19:52 +0900)
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>
generate-cmdlist.sh
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
fe0a9ea
)
diff --git
a/generate-cmdlist.sh
b/generate-cmdlist.sh
index eeea4b67ea7f1ccee1770c18a36d018b5f3b32b0..31b6d886cbdaf199a1e11246b2baf871dea97261 100755
(executable)
--- a/
generate-cmdlist.sh
+++ b/
generate-cmdlist.sh
@@
-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 */
struct cmdname_help {
char name[16];
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")
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 "};"
done
echo "};"