summaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorDan Reif <dan.reif@collectivehealth.com>2018-06-05 16:41:17 -0700
committerDan Reif <dan.reif@collectivehealth.com>2018-06-05 16:41:17 -0700
commit33f610feb73ce782cf41a7d9a377541991c692b5 (patch)
treedc35bcc889b6df6c6e6b6242e07f20f8309f0bc1 /build
parentd4da7817bacda51263f16e7dd82da15c7046e905 (diff)
downloadvim-polyglot-33f610feb73ce782cf41a7d9a377541991c692b5.tar.gz
vim-polyglot-33f610feb73ce782cf41a7d9a377541991c692b5.zip
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.
Diffstat (limited to 'build')
-rwxr-xr-xbuild30
1 files changed, 20 insertions, 10 deletions
diff --git a/build b/build
index 2668e0ea..381279c3 100755
--- a/build
+++ b/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="