Menu

gitpiper

Commander.js Cheat Sheet in April 2024

Last Updated: 7 April 2024

README.md

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);

Help

.on('--help', function() {
  console.log('');
})

Commands

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

Other useful things

process.exit(0);

338+ more cheat sheets for you in April 2024

Subscribe to our Newsletter

Subscribe to get resources directly to your inbox. You won't receive any spam! ✌️

© 2024 GitPiper. All rights reserved

Rackpiper Technology Inc

Company

About UsBlogContact

Subscribe to our Newsletter

Subscribe to get resources directly to your inbox. You won't receive any spam! ✌️