How to use the commander.version 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 jasonpolites / gcf-recipes / simulator / index.js View on Github external
#! /usr/bin/env node

var program = require('commander');
var cli = require('./app/cli.js');

program
  .version('0.0.1');
// .description('Google Cloud Functions Simulator')

program
  .command('start')
  .description('Starts the simulator')
  .action(cli.start)
  .option('--project-id ',
    'Your Google Cloud Platform project ID. If not provided, the process.env.GCLOUD_PROJECT environment variable will not be set'
  )
  .option('--debug',
    'If true, start the simulator in debug mode'
  );;

program
  .command('stop')
github esy / esy / esy-install / src / bin / runYarnCommand.js View on Github external
invocation: CommandInvocation,
  {
    commandName,
    cacheFolder,
  }: {
    commandName: string,
    cacheFolder: string,
  },
): Promise {
  // TODO:
  // handleSignals();

  const boolify = val => val.toString().toLowerCase() !== 'false' && val !== '0';

  // set global options
  commander.version(ctx.version, '-v, --version');
  commander.usage('[command] [flags]');
  commander.option('--verbose', 'output verbose messages on internal operations');
  commander.option(
    '--offline',
    'trigger an error if any required dependencies are not available in local cache',
  );
  commander.option(
    '--prefer-offline',
    'use network only if dependencies are not available in local cache',
  );
  commander.option('--strict-semver');
  commander.option('--json', '');
  commander.option('--ignore-scripts', "don't run lifecycle scripts");
  commander.option('--har', 'save HAR output of network traffic');
  commander.option('--ignore-platform', 'ignore platform checks');
  commander.option('--ignore-engines', 'ignore engines check');
github codexu / x-build / lib / initialization.js View on Github external
function programConfig() {
  program.version(requiredPackageVersion)
  .usage(' [options]');

  // 配置 项目创建指令
  program.command('create ')
    .description('create a new project powered by x-build')
    .option('-n, noversion', `Prohibited Version Detection`)
    .option('-q, quick', 'Quick Initialization Project')
    .action(async(name, cmd) => {
      // 判断是否存在创建的目录
      await hasDir(name);
      store.cmd = 'create';
      store.dirname = name;
      // 清空控制台,并输出当前 x-build 版本
      clearConsole('cyan', `X-BUILD v${requiredPackageVersion}`);
      // 判断参数 是否避免版本检测
      if (cmd.noversion) {
github projectkudu / KuduSync / bin / kudusync.js View on Github external
function main() {
    var commander = require("commander");
    var package = require("../package.json");
    var path = require("path");
    commander.version(package.version).usage("[options]").option("-f, --fromDir <dir path="">", "Source directory to sync").option("-t, --toDir <dir path="">", "Destination directory to sync").option("-s, --targetSubFolder <dir path="">", "A relative sub folder in the destination to create and copy files to").option("-n, --nextManifest ", "Next manifest file path").option("-p, --previousManifest [manifest file path]", "Previous manifest file path").option("-x, --ignoreManifest", "Disables the processing of the manifest file").option("-i, --ignore [patterns]", "List of files/directories to ignore and not sync, delimited by ;").option("-q, --quiet", "No logging").option("-v, --verbose [maxLines]", "Verbose logging with maximum number of output lines").option("-w, --whatIf", "Only log without actual copy/remove of files").option("--perf", "Print out the time it took to complete KuduSync operation").parse(process.argv);
    var commanderValues = commander;
    var fromDir = commanderValues.fromDir;
    var toDir = commanderValues.toDir;
    var targetSubFolder = commanderValues.targetSubFolder;
    var previousManifest = commanderValues.previousManifest;
    var nextManifest = commanderValues.nextManifest;
    var ignoreManifest = commanderValues.ignoreManifest;
    var ignore = commanderValues.ignore;
    var quiet = commanderValues.quiet;
    var verbose = commanderValues.verbose;
    var whatIf = commanderValues.whatIf;
    var perf = commanderValues.perf;
    if(quiet &amp;&amp; verbose) {
        console.log("Error: Cannot use --quiet and --verbose arguments together");
        process.exit(1);
        return;</dir></dir></dir>
github seppevs / migrate-mongo / bin / migrate-mongo.js View on Github external
console.log(`MIGRATED UP: ${migratedItem}`);
  });
}

function handleError(err) {
  console.error(`ERROR: ${err.message}`);
  process.exit(1);
}

function printStatusTable(statusItems) {
  const table = new Table({ head: ["Filename", "Applied At"] });
  statusItems.forEach(item => table.push(_.values(item)));
  console.log(table.toString());
}

program.version(pkgjson.version);

program
  .command("init")
  .description("initialize a new migration project")
  .action(() =>
    migrateMongo
      .init()
      .then(() =>
        console.log(
          `Initialization successful. Please edit the generated \`${migrateMongo.config.getConfigFilename()}\` file`
        )
      )
      .catch(err => handleError(err))
  );

program
github emersonsoares / spotydrive / app.js View on Github external
const program = require('commander')
const opn = require('opn')
const http = require('http')
const request = require('request')
const fs = require('fs')
const util = require('util')
const login = require('./login')

program
  .version('0.1.0')
  .option('-l, --login', 'Login to your Spotify Account')
  .parse(process.argv)

const getPlaylists = token => {
  return request.get('https://api.spotify.com/v1/me/playlists', {
    headers: {
      'Authorization': `Bearer ${token}`
    }
  }, (error, response, body) => {
    const playlists = JSON.parse(body)
    console.log(playlists.items.map(playlist => playlist.name))
  })
}

program.login && login()
github wuchangming / node-mitmproxy / lib / bin / index.js View on Github external
#!/usr/bin/env node
'use strict';

var MitmProxy = require('../mitmproxy/MitmProxy');
var program = require('commander');
var packageJson = require('../../package.json');
var tlsUtils = require('../tls/tlsUtils');

program.version(packageJson.version).command('createCA').action(function () {
    try {
        tlsUtils.initCA();
    } catch (e) {
        console.log(e);
    } finally {}
});

program.command('start').action(function () {
    try {
        var proxy = new MitmProxy({
            ssl: true,
            sslConnectInterceptor: function sslConnectInterceptor() {
                return true;
            }
        });
    } catch (e) {
github gorangajic / workmode / index.js View on Github external
WorkMode.prototype.commandLine = function() {
  var self = this;
  var program = require('commander');
  program
    .version('0.2.0')
    .option('status', "Tells whether Workmode is active.")
    .option('start', "Enables the black list. Off to work!")
    .option('stop', "Disbles the black list.")
    .option('add [domain]', "Adds the domain to the black list.")
    .option('remove [index|domain]', ["Removes one the domain at the given index. ",
                                      "If no parameter is passed, displays the blacklist ",
                                      "and prompts for one."].join())
    .option('list', 'Displays the blacklist.');

  program.on('stop', function() {
    var error, msg = self.stop();
    if (!(error = parseError(msg))) {
      self.writeHosts();
    }
    puts(error || msg);
github DavidCai1993 / style-transfer.js / transfer.js View on Github external
'use strict'
const transfer = require('commander')
const pkg = require('./package')

transfer.version(pkg.version)

transfer
  .command('transfer')
  .description('tranfer the style of the "content image"')
  .option('-c, --contentImagePath 
github kabirbaidhya / pglistend / src / program.js View on Github external
export function run() {
    prog.version(require('../package').version)
        .description('pglisten - Postgres LISTEN CLI tool')
        .usage('--config=