HOME


Mini Shell 1.0
Redirecting to https://devs.lapieza.net/iniciar-sesion Redirecting to https://devs.lapieza.net/iniciar-sesion.
DIR: /proc/1784574/task/1784574/root/usr/share/doc/node-commander/examples/
Upload File :
Current File : //proc/1784574/task/1784574/root/usr/share/doc/node-commander/examples/custom-help-text.js
#!/usr/bin/env node

// This example shows using addHelpText.

// const { Command } = require('commander'); // (normal include)
const { Command } = require('../'); // include commander in git clone of commander repo
const program = new Command();

program.name('awesome');

program
  .addHelpText('beforeAll', 'A W E S O M E\n')
  .addHelpText('afterAll', (context) => {
    if (context.error) {
      return '\nHelp being displayed for an error';
    }
    return '\nSee web site for further help';
  });

program
  .command('extra')
  .addHelpText('before', 'Note: the extra command does not do anything')
  .addHelpText('after', `
Examples:
  awesome extra --help
  awesome help extra`);

program.parse();

// Try the following:
//    node custom-help-text.js --help
//    node custom-help-text.js extra --help
//    node custom-help-text.js