moth/pkg/transpile/testdata/static/3/mkpuzzle

37 lines
557 B
Plaintext
Raw Normal View History

2020-08-31 16:37:51 -06:00
#! /bin/sh
2020-09-14 18:23:56 -06:00
fail () {
echo "ERROR: $*" 1>&2
exit 1
}
case $1:$2 in
puzzle:)
2020-08-31 16:37:51 -06:00
cat <<'EOT'
{
"Answers": ["answer"],
"Authors": ["neale"],
"Body": "I am a generated puzzle."
2020-08-31 16:37:51 -06:00
}
EOT
;;
2020-09-14 18:23:56 -06:00
file:moo.txt)
echo "Moo."
;;
file:*)
fail "no such file: $1"
;;
answer:moo)
2020-10-16 14:18:44 -06:00
echo '{"Correct":true}'
2020-09-14 18:23:56 -06:00
;;
answer:error)
fail "you requested an error"
2020-09-04 13:00:23 -06:00
;;
2020-09-14 18:23:56 -06:00
answer:*)
2020-10-16 14:18:44 -06:00
echo '{"Correct":false}'
2020-08-31 16:37:51 -06:00
;;
*)
2020-09-14 18:23:56 -06:00
fail "What is $1"
2020-08-31 16:37:51 -06:00
;;
esac