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