How to use the yargs.help 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 apache / incubator-weex-cli / bin / weex.js View on Github external
value: function transforme(inputPath, outputPath) {

            var transformP = void 0;
            var self = this;
            if (fs.lstatSync(inputPath).isFile()) {
                transformP = self.transformTarget(inputPath, outputPath); // outputPath may be null , meaning start server
            } else if (fs.lstatSync(inputPath).isDirectory) {
                try {
                    fs.lstatSync(outputPath).isDirectory;
                } catch (e) {
                    npmlog.info(yargs.help());
                    npmlog.info("when input path is dir , output path must be dir too");
                    process.exit(1);
                }

                var filesInTarget = fs.readdirSync(inputPath);
                filesInTarget = _.filter(filesInTarget, function (fileName) {
                    return fileName.length > 2;
                });
                filesInTarget = _.filter(filesInTarget, function (fileName) {
                    return fileName.substring(fileName.length - 2, fileName.length) == WEEX_FILE_EXT;
                });

                var filesInTargetPromiseList = _.map(filesInTarget, function (fileName) {
                    var ip = path.join(inputPath, fileName);
                    fileName = fileName.replace(/\.we/, '');
                    var op = path.join(outputPath, fileName + '.js');
github dunnock / react-sigma / scripts / build-cli.js View on Github external
/* eslint no-process-exit: 0 */

import 'colors';
import build from './build';
//import docs from '../docs/build';
import { setExecOptions } from './exec';

import yargs from 'yargs';

const argv = yargs
  .help('h')
  .option('sigma-only', {
    demand: false,
    default: false
  })
  .option('verbose', {
    demand: false,
    default: false,
    describe: 'Increased debug output'
  })
  .option('dev', {
    demand: false,
    default: false,
    describe: 'Only used when supplied with the --docs-only flag'
  })
  .option('stats', {
github APIDevTools / swagger-cli / bin / swagger-cli.js View on Github external
.option("d", {
      alias: "debug",
      type: "boolean",
    })
    .option("h", {
      alias: "help",
      type: "boolean",
    });

  // Show the version number on "--version" or "-v"
  yargs
    .version()
    .alias("v", "version");

  // Disable the default "--help" behavior
  yargs.help(false);

  // Parse the command-line arguments
  let args = yargs.argv;

  // Normalize the parsed arguments
  let parsed = {
    command: args._[0],
    file: args._[1],
    options: {
      schema: args.schema,
      spec: args.spec,
      outfile: args.outfile,
      dereference: args.dereference,
      format: args.format || 2,
      type: args.type || "json",
      wrap: args.wrap || Infinity,
github pauldijou / outdated / bin / outdated.js View on Github external
default: undefined,
      describe: 'Enable or disable Bower checking'
    },
    jspm: {
      type: 'boolean',
      default: undefined,
      describe: 'Enable or disable jspm checking'
    }
  })
  .alias('h', 'help')
  .showHelpOnFail(false, "Specify --help for available options")
  .epilog('License Apache 2. Copyright 2015 Paul Dijou.')
  .argv;

if (argv.help) {
  console.log(yargs.help());
} else if (argv._[0] === 'auth') {
  if (argv._[1] === 'add') {
    auth.add();
  } else if (argv._[1] === 'list' || argv._[1] === 'ls') {
    auth.list();
  } else if (argv._[1] === 'remove') {
    auth.remove();
  } else {
    console.log(logSymbols.error + chalk.red(' [Error]') + ' You can only use [add], [list] or [remove] with the [auth] command.')
  }
} else if (argv._[0] === 'config') {
  if (argv._[1] === undefined) {
    config.display();
  } else if (argv._[1] === 'reset') {
    config.reset();
  } else {
github depjs / dep / bin / dep.js View on Github external
const pkgJSON = require('../package.json')
const notifier = updateNotifier({ pkg: pkgJSON })

if (!semver.satisfies(process.version, pkgJSON.engine.node)) {
  process.stderr.write('dep works only on Node.js LTS versions\n')
  process.stderr.write('See the schedule: https://github.com/nodejs/LTS#lts-schedule1\n')
  process.exit(1)
}

if (notifier.update) {
  notifier.notify()
}

yargs.usage(pkgJSON.description)

yargs.help('help')
  .alias('help', 'h')

yargs.version(() => { return pkgJSON.version })
  .alias('version', 'v')
  .describe('version', 'Show version information')

Object.keys(commands).forEach((i) => {
  yargs.command(commands[i])
})

const argv = yargs.argv

if (!argv._handled) yargs.showHelp()
github pandonetwork / pando / packages / cli / src / commands / fetch / index.ts View on Github external
const builder = () => {
  return yargs.help().version(false)
}
github webextensions / live-css-editor / live-css / index.js View on Github external
(function () {
        var argv = require('yargs')
            .help(false)
            .version(false)
            .argv;

        var showHelp = function () {
            logger.verbose([
                '',
                'Format:   live-css [--root ] [--help]',
                'Examples: live-css',
                '          live-css --help',
                '          live-css --root project/http-pub',
                '          live-css --init',
                'Options:  -h --help                            Show help',
                '             --init                            Generate the configuration file for more customizations (recommended)',
                '             --list-files                      List the files being monitored',
                '          -p --port               Port number to run live-css server',
github longtian / fs-animation / options.js View on Github external
/**
 * Created by yan on 15-11-6.
 */

/**
 * this file will read from command line options or environment variables
 */

var yargs = require('yargs');
var dotFilesRegExp = /[\/\\]\./;

yargs
  .example('$0 /var/lib/docker/containers', 'Watch docker containers directory change')
  .epilog('MIT Licensed 2015 ');

yargs
  .help('h')
  .usage('Usage: $0 [[[dir1] dir2] dir3 ...]')
  .version(function () {
    return require('./package').version;
  });

yargs
  .default('port', process.env.PORT || 8001)
  .default('hostname', process.env.HOSTNAME || '127.0.0.1');

yargs
  .boolean('ignoreInitial')
  .default('ignoreInitial', true);

yargs
  .boolean('ignoredDotFiles')
github ccxcxd / GFDB-Web / bin / init.js View on Github external
function (argv) {
      initEntries()
    },
  );

yargs
  .command(
    'build',
    'init langs files without watching',
    {},
    function (argv) {
      initEntries();
    },
  );

yargs
  .help('h')
  .alias('h', 'help')
  .version(require(PACKAGE_JSON).version)
  .alias('version', 'v')
  .strict()
  .epilog('copyright 2018')
  .argv;