digraphs: warn if vim returns insufficient input
[sheet.git] / tools / mkdigraphs-vim
index d47a733e971932963dd5a96bcd8377ee5e2b0e95..a94812fe942f52a8eb4a513e3c28906e3ffa6fc5 100755 (executable)
@@ -1,10 +1,15 @@
 #!/bin/sh
-vim -e -cdigraphs -cq | perl -CSD -nE '
-       BEGIN {
+
+VERSION=1.00
+
+vim -e -c'echo version' -cdigraphs -cq | perl -CSD -nE '
+       if ($. == 1) { # head
+               say "# digraphs list from vim version ", s/\s*\z//r;
                say "+{";
-       }
+       } else { # body
                say "q{$1} => $3," while /\G(\S\S) (.[^ ]*) +([0-9]+)\s+/g;
-       END {
+       } END { # foot
                say "}";
+               exit warn "only $. lines of :digraphs output\n" if $. < 6;
        }
 '