node-minecraft-protocol icon indicating copy to clipboard operation
node-minecraft-protocol copied to clipboard

consider using minimist for options parsing in proxy example

Open rom1504 opened this issue 10 years ago • 3 comments

https://www.npmjs.com/package/minimist

rom1504 avatar Mar 14 '16 23:03 rom1504

Example https://github.com/feross/webtorrent-cli/blob/master/bin/cmd.js#L38 and maybe https://github.com/feross/webtorrent-cli/blob/master/bin/cmd.js#L167 (using es6 templates instead)

rom1504 avatar Mar 21 '16 09:03 rom1504

https://www.npmjs.com/package/commander is also a really nice module for cli argument parsing:

var program = require('commander');

program
  .version('0.0.1')
  .option('-p, --peppers', 'Add peppers')
  .option('-P, --pineapple', 'Add pineapple')
  .option('-b, --bbq-sauce', 'Add bbq sauce')
  .option('-c, --cheese [type]', 'Add the specified type of cheese [marble]', 'marble')
  .parse(process.argv);

console.log('you ordered a pizza with:');
if (program.peppers) console.log('  - peppers');
if (program.pineapple) console.log('  - pineapple');
if (program.bbqSauce) console.log('  - bbq');
console.log('  - %s cheese', program.cheese);

ghost avatar May 13 '16 21:05 ghost

Sorry I'm a bit late to the issue party, but you could also use my more lightweight package, gar. https://github.com/ethanent/gar

ethan7g avatar Jan 18 '18 07:01 ethan7g