UNPKG

offtext

Version:

Perform weird actions on your strings

57 lines 2.22 kB
#!/usr/bin/env node "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const commander_1 = require("commander"); const genCracked_1 = tslib_1.__importDefault(require("./utils/genCracked")); const genRandomCase_1 = tslib_1.__importDefault(require("./utils/genRandomCase")); const genReverse_1 = tslib_1.__importDefault(require("./utils/genReverse")); const isASCII_1 = tslib_1.__importDefault(require("./utils/isASCII")); const getPackageVersion_1 = tslib_1.__importDefault(require("./utils/getPackageVersion")); (() => tslib_1.__awaiter(void 0, void 0, void 0, function* () { const program = new commander_1.Command(); program .version(yield getPackageVersion_1.default(), '-v, --version') .description('Makes your ascii text look bizarre') .option('-d, --debug', 'extra output for debugging'); program .command('randomcase <text...>', { isDefault: true }) .aliases(['rc']) .description('Randomizes the case of text in a string') .action((textArray) => { const text = textArray.join(' '); if (!isASCII_1.default(text)) { console.error("Text isn't ASCII"); process.exit(1); } console.log(genRandomCase_1.default(text)); }); program .command('cracked <text...>') .aliases(['c']) .description('Converts a string into "cracked" text') .action((textArray) => { const text = textArray.join(' '); if (!isASCII_1.default(text)) { console.error("Text isn't ASCII"); process.exit(1); } console.log(genCracked_1.default(text)); }); program .command('reverse <text...>') .aliases(['rc']) .description('Reverses the text of a string') .action((textArray) => { const text = textArray.join(' '); if (!isASCII_1.default(text)) { console.error("Text isn't ASCII"); process.exit(1); } console.log(genReverse_1.default(text)); }); program.parse(process.argv); if (program.debug) console.log(program.opts()); }))(); //# sourceMappingURL=cli.js.map