Commit to Deno project.

This commit is contained in:
2021-04-28 16:55:22 -07:00
parent 2b1f9ffba1
commit c1935e58be
12 changed files with 104 additions and 43 deletions

44
main.ts Normal file
View File

@ -0,0 +1,44 @@
import Console from "./console.ts";
import parseCommand from "./parseCommand.ts";
async function main() {
const c = new Console();
const question = "Are you a butthole?";
let running = true;
let statement = "";
while (running) {
const prompts = `${statement}${question}`;
const answer = await c.ask(prompts);
const { action } = parseCommand(answer);
statement = "";
switch (action) {
case "quit":
running = quit(c);
break;
case "take":
break;
default:
statement = "I didn't understand that.\n";
break;
}
}
}
function quit(c: Console): boolean {
const confirmQuit = c.ask("Are you sure you want to quit?");
if (confirmQuit[0] === "y") {
return false;
}
return true;
}
main();