moth/pkg/transpile/testdata/generated/mkcategory

50 lines
739 B
Bash
Executable File

#! /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"],
"Pre": {
"Authors": ["author1.0"],
"Body": "<h1>moo.</h1>"
}
}
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