moth/cmd/transpile/testdata/mkcategory/mkcategory

48 lines
712 B
Plaintext
Raw Normal View History

2020-11-02 14:40:43 -07:00
#! /bin/sh -e
fail () {
echo "ERROR: $*" 1>&2
exit 1
}
case $1:$2:$3 in
inventory::)
cat <<EOT
{
"Puzzles": [1, 2, 3,
4, 5]
}
EOT
;;
puzzle:1:)
cat <<EOT
{
"Answers": ["answer1.0"],
"Authors": ["author1.0"],
"Body": "<h1>moo.</h1>"
2020-11-02 14:40:43 -07:00
}
EOT
;;
puzzle:*)
fail "No such puzzle: $2"
;;
file:1:moo.txt)
echo "Moo."
;;
file:*:*)
fail "No such file: $2"
;;
answer:1:answer1.0)
echo -n '{"Correct":true}'
;;
answer:1:*)
echo '{"Correct":false}'
;;
answer:*:*)
fail "Fail answer"
;;
*)
fail "What is $1" 1>&2
;;
esac