BeerJS Santiago - diciembre 2015
Problema
random CLI: NodeJS + CLI
❤ ❤ ❤ ❤
❤ CLI ❤
❤ ❤ ❤ ❤
// bin/random-cli.js
var program = require('commander');
program
.option( '-r, --range <from>..<to>', 'A range', range )
.option( '-l, --list <item1>,<item2>,<itemN>', 'A list comma separated', list )
.option( '-p, --password <length>', 'Length', password )
console.log(' ✔ Random from range: %j', program.range);
console.log(' ✔ Random from list: %j', program.list);
console.log(' ✔ Random password: %j', program.password);
$ node bin/random-cli.js -l uno,dos,tres,cuatro
// ✔ Random from list: ["cuatro"]