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

39 lines
571 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"],
"Pre": {
2020-09-01 20:12:57 -06:00
"Authors": ["neale"],
2020-08-31 16:37:51 -06:00
"Body": "I am a generated puzzle."
}
}
EOT
;;
2020-09-14 18:23:56 -06:00
file:moo.txt)
echo "Moo."
;;
file:*)
fail "no such file: $1"
;;
answer:moo)
echo "correct"
;;
answer:error)
fail "you requested an error"
2020-09-04 13:00:23 -06:00
;;
2020-09-14 18:23:56 -06:00
answer:*)
echo "incorrect"
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