tile38/core/gen.sh

18 lines
429 B
Bash
Raw Normal View History

2016-03-04 16:08:16 -07:00
#!/bin/sh
set -e
cd $(dirname $0)
export CommandsJSON="$(cat commands.json)"
2016-03-04 16:08:16 -07:00
# replace out the json
perl -pe '
while (($i = index($_, "{{.CommandsJSON}}")) != -1) {
substr($_, $i, length("{{.CommandsJSON}}")) = $ENV{"CommandsJSON"};
}
2016-03-08 05:32:39 -07:00
' commands.go > commands_gen.go
2016-03-04 16:08:16 -07:00
# remove the ignore
2022-09-12 17:06:27 -07:00
sed -i -e 's/\/\/go:build ignore/\/\/ This file was autogenerated. DO NOT EDIT./g' commands_gen.go
2016-03-08 05:32:39 -07:00
rm -rf commands_gen.go-e