mirror of https://github.com/dirtbags/moth.git
37 lines
557 B
Plaintext
37 lines
557 B
Plaintext
|
#! /bin/sh
|
||
|
|
||
|
fail () {
|
||
|
echo "ERROR: $*" 1>&2
|
||
|
exit 1
|
||
|
}
|
||
|
|
||
|
case $1:$2 in
|
||
|
puzzle:)
|
||
|
cat <<'EOT'
|
||
|
{
|
||
|
"Answers": ["answer"],
|
||
|
"Authors": ["neale"],
|
||
|
"Body": "I am a generated puzzle."
|
||
|
}
|
||
|
EOT
|
||
|
;;
|
||
|
file:moo.txt)
|
||
|
echo "Moo."
|
||
|
;;
|
||
|
file:*)
|
||
|
fail "no such file: $1"
|
||
|
;;
|
||
|
answer:moo)
|
||
|
echo '{"Correct":true}'
|
||
|
;;
|
||
|
answer:error)
|
||
|
fail "you requested an error"
|
||
|
;;
|
||
|
answer:*)
|
||
|
echo '{"Correct":false}'
|
||
|
;;
|
||
|
*)
|
||
|
fail "What is $1"
|
||
|
;;
|
||
|
esac
|