digraphs: ignore ansi commands in vim version output
[sheet.git] / tools / mkdigraphs-vim
index a4bdfe803e8e636ac7d99da5d9c06464c32f3a86..c1dcbe44e45ae09620f9a11262d587a700a33c6c 100755 (executable)
@@ -1,10 +1,17 @@
 #!/bin/sh
 
-VERSION=1.01
+VERSION=1.02
+
+if [ "$#" -ne 0 ]
+then
+       echo "Usage: $0 >digraphs-vim.inc.pl"
+       echo 'Collect digraph data from vim, standard output as Perl hash.'
+       exit 64 # EX_USAGE
+fi
 
 vim -e -c'echo version' -cdigraphs -cq | perl -CSD -nE '
        if ($. == 1) { # head
-               say "# digraphs list from vim version ", s/\s*\z//r;
+               say "# digraphs list from vim version ", m/(\d+)\s*\z/;
                say "+{";
        } else { # body
                while (/\G(\S\S) (.[^ ]*) +([0-9]+)\s+/g) {