Fix some stylistic,semantic and navigational issues
[llpp.git] / mkhelp.sh
blob0fcd7b05fa891ca04e8ab9c569423ad60d2c22fe
1 #!/bin/sh
2 set -e
3 ocaml str.cma -stdin "$1" "$2" <<EOF
4 let fixup = let open Str in
5 let dash = regexp {|\([^ ]*\) +- +\(.*\)|}
6 and head = regexp {|-----\(.*\)-----|} in fun s ->
7 String.escaped s |> global_replace dash {|\1\t\2|}
8 |> global_replace head {|\xc2\xb7\1|};;
9 let rec iter ic = match input_line ic with
10 | s -> Printf.printf "\"%s\";\\n" @@ fixup s; iter ic
11 | exception End_of_file -> ();;
12 Printf.printf "let keys = [\\n";
13 iter @@ open_in Sys.argv.(1);;
14 Printf.printf "];;\\nlet version = %S;;\\n" Sys.argv.(2);;
15 EOF