How to use the commander.description 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 jupyterlab / jupyterlab-data-explorer / buildutils / src / update-dependency.ts View on Github external
}
  }

  if (fileLog.length > 0) {
    console.log(packagePath);
    console.log(fileLog.join('\n'));
    console.log();
  }

  // Write the file back to disk.
  if (!dryRun && fileUpdated) {
    utils.writePackageData(packagePath, data);
  }
}

commander
  .description('Update dependency versions')
  .usage('[options]  [versionspec], versionspec defaults to ^latest')
  .option('--dry-run', 'Do not perform actions, just print output')
  .option('--regex', 'Package is a regular expression')
  .option('--lerna', 'Update dependencies in all lerna packages')
  .option('--path 
github skpm / skpm / lib / skpm-install.js View on Github external
var https = require('https')
var program = require('commander')
var chalk = require('chalk')
var semver = require('semver')
var Admzip = require('adm-zip')
var registry = require('skpm-client')
var Config = require('./utils/config')
var deleteFolder = require('./utils/deleteFolder')
var objectAssign = require('object-assign')
var getSketchVersion = require('./utils/getSketchVersion')

var config = Config.get()

var pluginDirectory = config.pluginDirectory

program
  .description('Install a new plugin')
  .usage('[options]  [otherNames...]')
  .arguments(' [otherNames...]')
  .action(function (name, otherNames) {
    program.names = [name]
    if (otherNames) {
      program.names = program.names.concat(otherNames)
    }
  })
  .parse(process.argv)

// if no plugin specified, install the stored config
if (!program.names || !program.names.length) {
  program.names = Object.keys(config.plugins).map(function (name) {
    return name + '@' + config.plugins[name]
  })
github max-team / Mars / packages / mars-cli / bin / mars-build.js View on Github external
/**
 * @file mars build
 * @author meixuguang
 */

/* eslint-disable fecs-no-require */
/* eslint-disable no-console */

const program = require('commander');
const {defaultConfig, cleanArgs} = require('../lib/helper/utils');

program
    .description('build project in production mode')
    .option('-r, --registry ', 'Use specified npm registry when installing dependencies (only for npm)')
    .option('-t, --target ', 'Build target (swan | h5 | wx, default: swan)')
    .option('-w, --watch', 'Open watch mode')
    .option('--h5skip ', 'Skip h5 compile process (mars | vue)')
    .action(cmd => {
        const build = require('../lib/build');
        const options = cleanArgs(cmd);

        if (!options.registry) {
            options.registry = defaultConfig.registry;
        }

        build(options);
    })
    .parse(process.argv);
github Azure / iothub-explorer / iothub-explorer-query-job.js View on Github external
#!/usr/bin/env node
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

'use strict';

var program = require('commander');
var prettyjson = require('prettyjson');
var serviceError = require('./common.js').serviceError;
var getSas = require('./common.js').getSas;
var JobClient = require('azure-iothub').JobClient;
var showDeprecationText = require('./common.js').showDeprecationText;

showDeprecationText('az iot hub job list');

program
  .description('Query existing jobs')
  .usage('[options] [job-type] [job-status]')
  .option('-l, --login ', 'use the connection string provided as argument to use to authenticate with your IoT Hub instance')
  .option('-r, --raw', 'use this flag to return raw output instead of pretty-printed output')
  .parse(process.argv);

var jobType = program.args[0];
var jobStatus = program.args[1];
var sas = getSas(program.login);

var jobClient =  JobClient.fromSharedAccessSignature(sas);
var query = jobClient.createQuery(jobType, jobStatus);
var onNewResults = function(err, results) {
  if (err) {
    serviceError(err);
  } else {
github Unity-Technologies / unity-cache-server / import.js View on Github external
const program = require('commander');
const consts = require('./lib/constants');
const fs = require('fs-extra');
const filesize = require('filesize');
const Client = require('./lib/client/client');
const ProgressBar = require('progress');

function myParseInt(val, def) {
    val = parseInt(val);
    return (!val && val !== 0) ? def : val;
}

const DEFAULT_SERVER_ADDRESS = 'localhost:8126';

program.description("Unity Cache Server - Project Import\n\n  Imports Unity project Library data into a local or remote Cache Server.")
    .version(require('./package').version)
    .arguments(' [ServerAddress]')
    .option('-l, --log-level ', 'Specify the level of log verbosity. Valid values are 0 (silent) through 5 (debug).', myParseInt, consts.DEFAULT_LOG_LEVEL)
    .option('--no-timestamp-check', 'Do not use timestamp check to protect against importing files from a project that has changed since last exported.', true)
    .option('--skip ', 'Skip to transaction # in the import file at startup.', myParseInt, 0)
    .action((projectRoot, serverAddress) => {
        helpers.setLogLevel(program.logLevel);
        serverAddress = serverAddress || DEFAULT_SERVER_ADDRESS;
        importTransactionFile(projectRoot, serverAddress, consts.DEFAULT_PORT)
            .catch(err => {
                console.log(err);
                process.exit(1);
            });
    });

program.parse(process.argv);
github caprover / caprover / app-cli / captainduckduck-deploy.js View on Github external
const packagejson = require('./package.json');

const configs = new configstore(packagejson.name, {
    captainMachines: [],
    apps: []
});

const BRANCH_TO_PUSH = 'branchToPush';
const APP_NAME = 'appName';
const MACHINE_TO_DEPLOY = 'machineToDeploy';
const EMPTY_STRING = '';

console.log(' ');
console.log(' ');

program
    .description('Deploy current directory to a Captain machine.')
    .option('-t, --tarFile ', 'Specify file to be uploaded (rather than using git archive)')
    .option('-d, --default', 'Run with default options')
    .option('-s, --stateless', 'Run deploy stateless')
    .option('-h, --host ', 'Only for stateless mode: Host of the captain machine')
    .option('-a, --appName ', 'Only for stateless mode: Name of the app')
    .option('-p, --pass ', 'Only for stateless mode: Password for Captain')
    .option('-b, --branch ', 'Only for stateless mode: Branch name (default master)')
    .parse(process.argv);


if (program.args.length) {
    console.error(chalk.red('Unrecognized commands:'));
    program.args.forEach(function (arg) {
        console.log(chalk.red(arg));
    });
github Silind-Software / direflow / cli / cli.ts View on Github external
.command('create')
    .alias('c')
    .description('Create a new Direflow Setup')
    .option('-p, --project', 'Deprecated: Create a new Direflow Project')
    .option('-c, --component', 'Create a new Direflow Component')
    .action((args: any) => {
      if (args.project) {
        createProject();
      } else if (args.component) {
        createDireflowSetup();
      } else {
        create();
      }
    });

  program.description(chalk.magenta(headline));

  program.version(showVersion(), '-v, --version', 'Show the current version');
  program.helpOption('-h, --help', 'Show how to use direflow-cli');

  if (!process.argv.slice(2).length) {
    console.log('');
    program.help();
  }

  if (process.argv[2] === '-v' || process.argv[2] === '--version') {
    console.log(checkForUpdates());
  }

  program.parse(process.argv);
};
github fxpio / fxp-satis-serverless / bin / show-github-token.js View on Github external
*
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

'use strict';

require('dotenv').config();
const program = require('commander');
const fetch = require('node-fetch');
const utils = require('./utils/utils');
const getEndpoint = require('./utils/endpoint').getEndpoint;
const validateResponse = require('./utils/endpoint').validateResponse;
const createHeaders = require('./utils/endpoint').createHeaders;

program
    .description('Show your token for Github Webhooks')
    .option('-e, --endpoint [url]', 'Define the endpoint of Satis Serverless API (use for local dev)', false)
    .parse(process.argv);

utils.spawn('node bin/config -e')
    .then(() => getEndpoint(program))
    .then((endpoint) => {
        return fetch(endpoint + '/manager/github-token', {
            method: 'GET',
            headers: createHeaders()
        })
    })
    .then(async (res) => await validateResponse(res))
    .then(async (res) => (await res.json()).message)
    .then((mess) => console.info(mess))
    .catch(utils.displayError);
github andjosh / clubhouse-cli / src / bin / club-search.ts View on Github external
#!/usr/bin/env node
import spinner from '../lib/spinner';
import * as commander from 'commander';

import configure from '../lib/configure';
import storyLib, { StoryHydrated } from '../lib/stories';

const spin = spinner('Finding... %s ');
const log = console.log;

export const program = commander
    .description(
        `Search through clubhouse stories. Arguments (non-flag/options) will be
  passed to Clubhouse story search API as search operators. Passing '%self%' as
  a search operator argument will be replaced by your mention name. Note that
  passing search operators and options (e.g. --owner foobar) will use the
  options as extra filtering in the client.

  Refer to https://help.clubhouse.io/hc/en-us/articles/360000046646-Search-Operators
  for more details about search operators.`
    )
    .usage('[options] [SEARCH OPERATORS]')
    .option('-a, --archived', 'Include archived Stories')
    .option(
        '-c, --created [operator][date]',
        'Stories created within criteria (operator is one of <|>|=)',
        ''
github pgilad / angular-html5 / bin / angular-html5.js View on Github external
'use strict';

var fs = require('fs');
var path = require('path');
var program = require('commander');
var htmlify = require('../index');
var logSymbols = require('log-symbols');
var stdin = require('get-stdin');
process.title = 'angular-html5';

function collect(val, memo) {
    memo.push(val);
    return memo;
}

program
    .description('Change your ng-attributes to data-ng-attributes for html5 validation')
    .version(require(path.join(__dirname, '../package.json')).version)
    .usage('[options] ')
    .option('-c, --custom-prefix [prefixes]', 'Optionally add custom prefixes to the list of converted directives.', collect, [])
    .on('--help', function () {
        console.log('  Examples:');
        console.log('');
        console.log('    $ angular-html5 index.js');
        console.log('    $ angular-html5 --custom-prefix ui --custom-prefix gijo index.js > ./dist/index.js');
        console.log('    $ cat index.js | angular-html5 > ./dist/index.js');
        console.log('');
    })
    .parse(process.argv);

function run(contents, params) {
    params = params || {};