1

Commander.js

 2 years ago
source link: https://devhints.io/commander.js
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Initialize

var cli = require('commander');

Options

cli
  .version(require('../package').version)
  .usage('[options] <command>')
  .option('-w, --words <n>', 'generate <n> words')
  .option('-i, --interval <n>', 'interval [1000]', 1000)
  .option('-s, --symbols', 'include symbols')
  .parse(process.argv);
.on('--help', function() {
  console.log('');
})

Commands

cli.outputHelp();
cli.args == ["hello"];

Other useful things

process.exit(0);

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK