How to use the commander.parse 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 vipshop / ams / packages / ams-cli / bin / ams-dev.js View on Github external
let app = new WebpackDevServer(compiler, {
                    // 注意此处publicPath必填
                    publicPath: '/'
                });

                app.listen(9527, 'localhost', function (err) {
                    if (err) {
                        console.log(err);
                    }
                });
            } catch (e) {
                console.log(chalk.red(`ams ERR: ${e}`));
            }
        });

    program.parse(process.argv);
});
github OpenNeuroOrg / openneuro / packages / openneuro-cli / src / cli.js View on Github external
.command('download  ')
  .alias('d')
  .description(
    'Download a dataset draft or snapshot. If neither is specified, will prompt with available snapshots.',
  )
  .option('--draft')
  .option('-s, --snapshot [snapshotVersion]')
  .action(download)

commander.command('*', { noHelp: true, isDefault: true }).action(() => {
  // eslint-disable-next-line no-console
  console.log('Unknown command!')
  commander.outputHelp(make_red)
})

commander.parse(process.argv)

if (!process.argv.slice(2).length) {
  commander.outputHelp(make_red)
}

function make_red(txt) {
  return colors.red(txt) //display the help text in red on the console
}
github RodrigoEspinosa / gitter-cli / lib / main.js View on Github external
.command('whoami')
  .alias('me')
  .description('Display your user information based on the existing token.')
  .action(Commands.whoAmI);

Program
  .command('rooms')
  .alias('status')
  .description('Display a list of rooms that you are part of.')
  .action(Commands.rooms);

Program
  .option('--token [token]', 'Set the access-key token for client authentication. This won\'t be persisted.');

// Parse the application arguments.
Program.parse(process.argv);

// Check if there are no arguments.
if (!process.argv.slice(2).length) {
  // Display the application help.
  Program.outputHelp();
}

// Check if there is a token on the arguments.
if (Program.token) {
  Commands.setToken(Program.token);
}
github bespoken / bst / bin / bst-server.ts View on Github external
.command("start  ")
    .description("Starts the BST server")
    .action(function () {
        const webhookPort = parseInt(process.argv[3]);

        // We typically listen on multiple ports - 5000 and 80
        // All the args after the webhook port are treated as node (tunnel) ports
        const serverPorts: number[] = [];
        for (let i = 4; i < process.argv.length; i++) {
            serverPorts.push(parseInt(process.argv[i]));
        }
        const bespokeServer = new BespokeServer(webhookPort, serverPorts);
        bespokeServer.start();
    });

program.parse(process.argv);
github karthikv / nodefront / test / resources / minify / input / script.js View on Github external
var program = require('commander');
program.parse(process.argv);
github bluekvirus / Stage.js / tools / build / run.js View on Github external
rimraf = require('rimraf'),
AdmZip = require('adm-zip'),
targz = new (require('tar.gz'))(9, 9),
fs = require('fs-extra'),
wrench = require('wrench');
_.string = require('underscore.string');


program.version('1.0.1')
		.usage('[options] [output folder]')
		.option('-B --base 
github johntitus / coinx / commands / coinx-price.js View on Github external
const chalk = require('chalk');
const capitalize = require('capitalize');
const columnify = require('columnify');

const cryptocompare = require('../lib/cryptocompare');

const coins = coinx.coins();
const exchanges = Object.values(coinx.exchanges());
delete exchanges.passwordHash;

if (Object.keys(coins).length === 0) {
	console.error(chalk.red('Please run `coinx update` to get the latest list of coins.'));
	process.exit(1);
}

program.parse(process.argv);

var symbol = program.args;

if (!symbol.length) {
	console.error(chalk.red('No coin symbol provided.'));
	process.exit(1);
}

symbol = symbol[0].toUpperCase();

if (coins[symbol]){
	console.log(chalk.blue('Getting prices for ' + coins[symbol].name + ' (' + symbol + ')...'));
} else {
	console.log(chalk.blue('Getting prices for ' + symbol + '...'));
}
github dotansimha / graphql-code-generator / packages / utils / codegen-templates-scripts / cli / codegen-templates-scripts.js View on Github external
#!/usr/bin/env node

const program = require('commander');
const pack = require('../package.json');

program.version(pack.version);

program
  .command('init', 'Initialize a new template boilerplate in the current directory')
  .command('build', 'Executes build using Webpack and Handlebars')
  .command('test', 'Executes unit tests using Jest');

program.parse(process.argv);
github ulizama / TiFastlane / cli.js View on Github external
program.command('playsend')
    .description('Send all available resources of App to Google Play Store')
    .option('-c, --config [value]', "Use another config file found in the root")
    .option('--skip_upload_apk', 'Skip uploading an APK to Google Play')
    .option('--skip_upload_metadata', 'Whether to skip uploading metadata')
    .option('--skip_upload_images', 'Whether to skip uploading images, screenshots not included')
    .option('--skip_upload_screenshots', 'Whether to skip uploading SCREENSHOTS')
    .option('--skip_upload_graphic_assets', 'Wether to sekip uploading all type of images, including screenshots')
    .option('--skip_build', 'Skip build of APK')
    .option('--bump_build_version', 'Automatically bump Android build version')
    .option('-a, --track [value]', 'The Track to upload the Application to: production, beta, alpha or rollout')
    .option('-r, --rollout [value]', 'The percentage of the rollout')
    .action(playsend)
    ;

program.parse(process.argv);


if (program.args.length === 0 || typeof program.args[program.args.length - 1] === 'string') {
	notifier.update && notifier.notify();
	program.help();
}


/*
@ setup
*/
function setup(opts){
    notifier.update && notifier.notify();

	var options = _filterOptions(opts);
github gd4Ark / fa-cli / bin / fa.js View on Github external
checkVersion(() => {
      require('@/command/delete')(type)
    })
  })

program
  .command('list [type]')
  .description('List, optional [page], default is page')
  .alias('l')
  .action((type = 'page') => {
    checkVersion(() => {
      require('@/command/list')(type)
    })
  })

program.parse(process.argv)

if (!program.args.length) {
  program.help()
}