moth/cmd/transpile/testdata/3/mkpuzzle

45 lines
820 B
Bash
Executable File

#! /bin/sh
case $1 in
"")
cat <<'EOT'
{
"Answers": ["answer"],
"Pre": {
"Authors": ["neale"],
"Body": "I am a generated puzzle."
}
}
EOT
;;
-file|--file)
case $2 in
moo.txt)
echo "Moo."
;;
*)
echo "ERROR: no such file: $1" 1>&2
exit 1
;;
esac
;;
-answer|--answer)
case $2 in
moo)
echo "correct"
;;
error)
echo "error" 1>&2
exit 1
;;
*)
echo "incorrect"
;;
esac
;;
*)
echo "ERROR: don't know what to do with $1" 1>&2
exit 1
;;
esac