How to use the yargs.showHelp function in yargs

To help you get started, we’ve selected a few yargs 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 saucelabs / speedo / src / commands / run.js View on Github external
export const handler = async (argv) => {
    const config = getConfig(argv)
    const username = config.user || process.env.SAUCE_USERNAME
    const accessKey = config.key || process.env.SAUCE_ACCESS_KEY
    const jobName = getJobName(config)
    const buildName = config.build || `${jobName} - ${(new Date()).toString()}`
    const budget = config ? config.budget : null
    const metrics = budget ? getBudgetMetrics(budget) : getMetricParams(config)
    const jankinessScore = getJankinessParam(argv, budget)
    /**
     * check if username and access key are available
     */
    if (!username || !accessKey) {
        yargs.showHelp()
        // eslint-disable-next-line no-console
        console.error(ERROR_MISSING_CREDENTIALS)
        return process.exit(1)
    }

    const status = ora(`Start performance test run with user ${username} on page ${config.site}...`).start()

    const logDir = config.logDir
        ? path.resolve(process.cwd(), config.logDir)
        : tmp.dirSync().name

    /**
     * check if job already exists
     */
    const user = new SauceLabs({
        user: username,
github FlandreDaisuki / dmhy-subscribe / bin / cli.js View on Github external
Promise.all(allTasks)
      .then(() => {
        if (argv.x) {
          print.success(l10n('MAIN_ALL_X_DONE'));
        } else {
          print.success(l10n('MAIN_ALL_DONE'));
        }
        db.save();
      })
      .catch((_) => {
        // Error will print by downloaders, keep quiet
      });
  } else if (argv._.length > 1 || !supportCommands.includes(argv._[0])) {
    // Unknown command
    yargs.showHelp();
  }
}
github aurelia / aurelia / test / js-framework-benchmark / webdriver-ts / src / isKeyed.ts View on Github external
function main() {
  if (args.help) {
    yargs.showHelp();
  } else {
    runBench(runFrameworks).catch((error: Error) => { throw error; });
  }
}
github terascope / teraslice / packages / data-types / src / command.ts View on Github external
function throwHelpError(msg: string): never {
    yargs.showHelp('error');
    console.error(`\nERROR: ${msg}`);
    return process.exit(1);
}
github chainpoint / chainpoint-cli / cli.js View on Github external
async function processArgsAsync() {
    let input
    try {
      let inputItems = []
      input = await getStdin()
      if (input) {
        inputItems = input.trim().split(' ')
        yargs.parse(inputItems)
      }
    } catch (error) {
      yargs.showHelp()
      console.error(`Error reading from stdin: ${input}`)
    }

    let argv = yargs
      .usage(
        'Usage: ' +
          require.main.filename
            .split('/')
            .pop()
            .slice(0, -3) +
          '  [options] '
      )
      .option('s', {
        alias: 'server',
        requiresArg: true,
        default: env.CHAINPOINT_NODE_API_BASE_URI,
github RonaldTreur / STSS / lib / cli.js View on Github external
function parseArguments(args) {
	var argv = yargs.parse(args);

	if (argv.help) {
		yargs.showHelp();
		process.exit(0);
		return;
	}

	if (argv.jmk) {
		var install = require('../scripts/install');
		install(process.cwd());
		process.exit(0);
		return;
	}	

	var options = {
		stdout: argv.stdout,
		verbose: argv.verbose
	};
github alexilyaev / stylelint-find-rules / src / lib / cli.js View on Github external
);

    return process.exit(1);
  }

  if (
    !argv.unused &&
    !argv.deprecated &&
    !argv.invalid &&
    !argv.current &&
    !argv.available
  ) {
    printColumns(
      chalk.red(`Oops, one of the command line Options must be set...${EOL}`)
    );
    yargs.showHelp();

    return process.exit(1);
  }

  return cosmiconfig;
}
github wincent / yak-layout / src / index.js View on Github external
})
    .help('h')
    .alias('h', 'help')
    .version(json.version)
    .epilog(json.homepage)
    .strict()
    .argv;

  const command = argv._[0];

  if (command === 'corpus-stats') {
    const corpusPath = path.join('yak', 'corpus.txt');
    const corpus = await readFile(corpusPath);
    printStats(corpus.toString().toLowerCase());
  } else {
    yargs.showHelp();
  }
})();
github rtfpessoa / diff2html-cli / src / yargs.ts View on Github external
export function help(): void {
  yargs.showHelp("log");
}