mirror of
https://github.com/sheerun/vim-polyglot.git
synced 2025-11-14 06:23:50 -05:00
Changes to build for README.md updates
* Make the number of packages in the project easier to find. * Replace `ed` with `awk` in `update_readme()`, the latter being (_arguably_!) more readable/less fragile.
This commit is contained in:
30
build
30
build
@@ -127,17 +127,27 @@ copy_file() {
|
||||
}
|
||||
|
||||
update_readme() {
|
||||
ed README.md <<- EOF
|
||||
/Language packs
|
||||
+2kb
|
||||
/##
|
||||
'b,-2c
|
||||
$(echo -n "$OUTPUT" | sort)
|
||||
.
|
||||
w
|
||||
q
|
||||
EOF
|
||||
local tf of
|
||||
tf="$(mktemp)"
|
||||
of="$(mktemp)"
|
||||
sort <<<"$OUTPUT" | grep -vxE '[[:space:]]*' > "$of"
|
||||
|
||||
awk 'suppress == 0 {
|
||||
gsub(/<!--Package Count-->[^<]*<!--\/Package Count-->/,
|
||||
"<!--Package Count-->'"$(awk 'END {print NR}' "$of")"'<!--/Package Count-->");
|
||||
print;
|
||||
}
|
||||
/<!--Language Packs-->/ {
|
||||
suppress = 1;
|
||||
while ( ( getline line < "'"$of"'" ) > 0 ) {
|
||||
print line;
|
||||
}
|
||||
}
|
||||
/<!--\/Language Packs-->/ {
|
||||
suppress = 0;
|
||||
print;
|
||||
}' "README.md" >"$tf"
|
||||
mv "$tf" "README.md"
|
||||
}
|
||||
|
||||
PACKS="
|
||||
|
||||
Reference in New Issue
Block a user