How to use the commander.outputHelp function in commander

To help you get started, we’ve selected a few commander examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gre / gl-transition-libs / packages / gl-transition-scripts / src / gl-transition-transform.js View on Github external
// FIXME later if needed, can do more commands, like per file transforming
program
  .version("0.0.1")
  .option("-d, --glsl-dir <dir>", "a folder containing *.glsl files")
  .option(
    "-o, --json-out ",
    "a JSON file to save with all transitions",
    "-"
  )
  .parse(process.argv);

const { glslDir, jsonOut } = program;

if (!glslDir || !jsonOut) {
  program.outputHelp();
  process.exit(1);
}

const ms = (n: number) =&gt; (n &lt; 1 ? n.toFixed(2) : Math.round(n)) + "ms";

const files = fs.readdirSync(glslDir).filter(n =&gt; n.match(/^.*\.glsl$/));
const transitions = [];
console.error(files.length + " transitions to transform...");
console.error("");
files.forEach(filename =&gt; {
  const fullPath = path.join(glslDir, filename);
  const glsl = fs.readFileSync(fullPath, "utf-8");
  const result = transform(filename, glsl, fullPath);
  if (result.errors.length &gt; 0) {
    console.error(` ✕ ${result.data.transition.name}`);
    console.error("");</dir>
github foxythemes / jira-cli / src / index.js View on Github external
.option("-n, --number ", "Set the version number")
    .option("-d, --description ", "Set the description")
    .option("-s, --start-date ", "Set the start date")
    .option("-r, --release-date ", "Set the release date")
    // Get project versions
    .action((c, o) =&gt; {
      jira.cmdVersion(c, o);
    });


  /**
   * Show help if executes with no arguments
   */

  if (!process.argv.slice(2).length) {
    cl.outputHelp();
  }

  cl.parse(process.argv);


  /**
   * Execute default method if no registered command or no command is given
   */

  if ( process.argv.slice(2).length  ) {

    // Check if an argument is passed in position 1
    if ( typeof cl.args[1] !== 'undefined' ) {
      if( !cl.args[1].constructor.name == "Command" ) {
        jira.cmdDefault( cl );
      }
github mui-org / material-ui / test / cli.js View on Github external
return runE2ETests({ local, browsers });
  });

program
  .command('regressions')
  .description('Run the visual regression tests')
  .option('-l, --local', 'Use nightwatch.local.conf.js')
  .option('-e, --environment', 'Comma separated string of browser test environment names')
  .option('-c, --create-baseline', 'Create the baseline images instead of running a test')
  .action((command) => {
    const { local, browsers, createBaseline } = command;
    return runRegressionsTests({ local, browsers, createBaseline });
  });

if (!process.argv.slice(2).length) {
  program.outputHelp();
} else {
  program.parse(process.argv);
}
github microsoft / botbuilder-tools / MSBot / bin / msbot-connect-cosmosdb.js View on Github external
function showErrorHelp() {
    program.outputHelp((str) => {
        console.error(str);
        return '';
    });
    process.exit(1);
}
//# sourceMappingURL=msbot-connect-cosmosdb.js.map
github keymanapp / keyman / developer / js / source / kmlmp.ts View on Github external
function exitDueToUsageError(message: string): never  {
  console.error(`${program._name}: ${message}`);
  console.error();
  program.outputHelp();
  return process.exit(SysExits.EX_USAGE);
}
github gre / gl-transition-libs / packages / gl-transition-scripts / src / gl-transition-render.js View on Github external
width,
  height,
  images,
  genericTexture,
} = program;

if (
  !width ||
  !height ||
  !images ||
  images.length === 0 ||
  !transition ||
  transition.length === 0 ||
  !out
) {
  program.outputHelp();
  process.exit(1);
}

const gl = createGL(width, height, { preserveDrawingBuffer: true });
if (!gl) throw new Error("GL validation context could not be created");

gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);

const data = new Uint8Array(width * height * 4);
const pixels = ndarray(data, [height, width, 4])
  .transpose(1, 0, 2)
  .step(1, -1, 1);

const extraImagesSrc = genericTexture ? [genericTexture] : [];

function readTransition(str) {
github substack / clocker / bin / index.js View on Github external
function initialize (cmd) {
  if (typeof cmd !== 'object') {
    program.outputHelp()
    process.exit(1)
  }
  return new Clocker({
    dir: dir(cmd)
  })
}
github ampproject / amphtml / validator / nodejs / index.js View on Github external
'The input format to be validated.\n' +
              '  AMP by default.',
          'AMP')
      .option(
          '--format ',
          'How to format the output.\n' +
              '  "color" displays errors/warnings/success in\n' +
              '          red/orange/green.\n' +
              '  "text"  avoids color (e.g., useful in terminals not\n' +
              '          supporting color).\n' +
              '  "json"  emits json corresponding to the ValidationResult\n' +
              '          message in validator.proto.',
          'color')
      .parse(process.argv);
  if (program.args.length === 0) {
    program.outputHelp();
    process.exit(1);
  }
  if (program.html_format !== 'AMP' &amp;&amp; program.html_format !== 'AMP4ADS' &amp;&amp;
      program.html_format !== 'AMP4EMAIL' &amp;&amp;
      program.html_format !== 'ACTIONS') {
    process.stderr.write(
        '--html_format must be set to "AMP", "AMP4ADS", "AMP4EMAIL", or ' +
            '"ACTIONS.\n',
        function() {
          process.exit(1);
        });
  }
  if (program.format !== 'color' &amp;&amp; program.format !== 'text' &amp;&amp;
      program.format !== 'json') {
    process.stderr.write(
        '--format must be set to "color", "text", or "json".\n', function() {
github Alfresco / alfresco-ng2-components / lib / cli / scripts / init-aae-env.ts View on Github external
async function main(args) {

    program
        .version('0.1.0')
        .description('The following command is in charge of Initializing the activiti cloud env with the default apps' +
            'adf-cli init-aae-env --host "gateway_env"  --oauth "identity_env" --identityHost "identity_env" --username "username" --password "password"')
        .option('-h, --host [type]', 'Host gateway')
        .option('-o, --oauth [type]', 'Host sso server')
        .option('--clientId[type]', 'sso client')
        .option('--username [type]', 'username')
        .option('--password [type]', 'password')
        .parse(process.argv);

    if (process.argv.includes('-h') || process.argv.includes('--help')) {
        program.outputHelp();
    }

    const alfrescoJsApi = getAlfrescoJsApiInstance(args);
    await login(args, alfrescoJsApi);

    const result = { isValid: true };

    AAE_MICROSERVICES.map(async (serviceName) => {
        await healthCheck(args, alfrescoJsApi, serviceName, result);
    });

    if (result.isValid) {
        logger.error('The envirorment is up and running');
        await deployMissingApps(args, alfrescoJsApi);
    } else {
        logger.error('The envirorment is not up');
github miguelmota / streamhut / packages / client / cli.js View on Github external
function constructWebsocketUrl (props) {
  const {host, port, channel, notSecure} = props
  const scheme = notSecure ? 'ws' : 'wss'

  if (!host || !channel) {
    program.outputHelp()
    return false
  }

  const path = (channel || '').replace(/^\/?/, '/')

  return `${scheme}://${host}${port ? `:${port}` : ''}${path}`
}