UNPKG

goofy-cookie-cli

Version:

A goofy cookie-themed CLI for fun

51 lines (46 loc) 1.86 kB
const { printWithEmoji, colors } = require('../utils/print'); function handleCookieJarCommands(input) { const [cmd, ...args] = input.toLowerCase().split(/\s+/); const color = Math.random() < 0.5 ? colors.purple : colors.pink; switch (cmd + " " + (args[0] || "")) { case "cookie bake": printWithEmoji("🍪 You bake a batch of delicious cookies. Yum!", color); break; case "cookie eat": printWithEmoji("😋 You eat a cookie. Sweet and satisfying.", color); break; case "cookie fortune": // delegate to easter eggs cookie fortune or just print with color printWithEmoji("🔮 Your fortune cookie says: \"Good things come to those who wait.\"", color); break; case "cookie fun": printWithEmoji("Fun commands include: hug, pat, love, give, vibe. Try 'cookie hug @user'.", color); break; case "cookie hug": createFunResponse("🤗", "hugs", args, color); break; case "cookie pat": createFunResponse("🖐️", "pats", args, color); break; case "cookie love": createFunResponse("❤️", "sends love to", args, color); break; case "cookie give": createFunResponse("🎁", "gives a cookie to", args, color); break; case "cookie vibe": createFunResponse("🎶", "starts vibing with", args, color); break; default: printWithEmoji(`Unknown cookie jar command: "${input}". Try 'cookie help'.`, color); } } function createFunResponse(emoji, action, args, color) { const userArg = args.find(arg => arg.startsWith("@")); if (userArg) { printWithEmoji(`${emoji} Cookie ${action} ${userArg}!`, color); } else { printWithEmoji(`${emoji} Cookie ${action} itself... adorable!`, color); } } module.exports = { handleCookieJarCommands };