UNPKG

max-say

Version:

A fun console library that displays a cute text dog with 'Я собаня' message

63 lines (60 loc) 1.79 kB
#!/usr/bin/env node "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const index_1 = require("./index"); function showHelp() { console.log(` Usage: max-say [options] [message] Options: -h, --help Show this help message -f, --font Specify font to use (e.g., 'standard', 'block', 'bubble') -v, --version Show version Examples: max-say # Show default dog with "Я собаня" max-say "Привет мир!" # Show dog with custom message max-say -f Block "Круто!" # Show dog with custom font and message Available fonts: Standard, Block, Bubble, Lean, Mini, Script, Slant, Small, Big, Digital `); } function showVersion() { const packageJson = require('../package.json'); console.log(`max-say v${packageJson.version}`); } function main() { const args = process.argv.slice(2); let message; let font; // Parse arguments for (let i = 0; i < args.length; i++) { const arg = args[i]; if (arg === '-h' || arg === '--help') { showHelp(); return; } if (arg === '-v' || arg === '--version') { showVersion(); return; } if (arg === '-f' || arg === '--font') { font = args[i + 1]; i++; // Skip next argument continue; } // If not a flag, treat as message if (!message && !arg.startsWith('-')) { message = arg; } } // Create MaxSay instance and display const maxSay = new index_1.MaxSay(); if (font) { console.log(maxSay.sayWithFont(message, font)); } else { console.log(maxSay.say(message)); } } if (require.main === module) { main(); } //# sourceMappingURL=cli.js.map