UNPKG

kraft

Version:

A mysterious command line game with lots of secrets

15 lines (11 loc) 623 B
const Commands = {}; // TODO: Check if stuff exists otherwise throw errors, man, srsly, do this at some point exports.command = (command, handler) => Commands[command] = { handler: handler }; exports.exists = (command) => !!Commands[command]; exports.execute = (command, args) => { if (command) { Commands[command] ? Commands[command].handler.apply(null, args) : console.log('We do not know that command...'.red); } else { console.log('Welcome to', 'kraft'.green, ': A mysterious command game that involves gathering resources, building, crafting, and holds', 'many secrets'.green); } };