How to use the commander.name 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 zhansingsong / create-fes / packages / create-fes / lib / createFesApp.js View on Github external
})
  .option(
    '--scripts-version ',
    'use a non-standard version of fes-scripts'
  )
  .option('-t, --typescript', 'use typescript')
  .option('-B, --no-babel', 'not use babel')
  .option('-n, --npm', 'use npm')
  .option('--verbose', 'print additional logs')
  // .allowUnknownOption()
  .version(packageJson.version, '-v, --version')
  .parse(process.argv);

if (typeof projectName === 'undefined') {
  console.error('Please specify the project directory:');
  console.log(`  ${chalk.cyan(program.name())} ${chalk.green('')}`);
  console.log();
  console.log('For example:');
  console.log(`  ${chalk.cyan(program.name())} ${chalk.green('my-fes-app')}`);
  console.log();
  console.log(`Run ${chalk.cyan(`${program.name()} --help`)} to see all options.`);
  process.exit(1);
}

function run(root, appName, version, verbose, originalDirectory, useYarn, useBabel, useTypescript) {
  const packageToInstall = getInstallPackage(version);
  const allDependencies = [packageToInstall];
  let babelrc = {};

  if (useBabel || useTypescript) {
    allDependencies.push('@babel/core', '@babel/preset-env', 'babel-loader');
    babelrc = { presets: ['@babel/preset-env'] };
github alibaba / funcraft / bin / fun-nas-info.js View on Github external
#!/usr/bin/env node

/* eslint-disable quotes */

'use strict';

const program = require('commander');
const getVisitor = require('../lib/visitor').getVisitor;
const notifier = require('../lib/update-notifier');

program
  .name('fun nas info')
  .description('Print nas config information, such as local temp directory of NAS.')
  .option('-t, --template [template]', 'The path of fun template file.')
  .parse(process.argv);

if (program.args.length) {
  console.error();
  console.error("  error: unexpected argument '%s'", program.args[0]);
  program.help();
}

notifier.notify();

getVisitor(true).then((visitor) => {
  visitor.pageview('/fun/nas/info').send();
github microsoft / botbuilder-tools / MSBot / bin / msbot-connect.js View on Github external
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
 * Copyright(c) Microsoft Corporation.All rights reserved.
 * Licensed under the MIT License.
 */
const chalk = require("chalk");
const program = require("commander");
program.Command.prototype.unknownOption = function (flag) {
    console.error(chalk.default.redBright(`Unknown arguments: ${process.argv.slice(2).join(' ')}`));
    showErrorHelp();
};
program
    .name('msbot connect')
    .command('appinsights', 'connect to Azure AppInsights')
    .command('blob', 'connect to Azure Blob storage')
    .command('bot', 'connect to Azure Bot Service')
    .command('cosmosdb', 'connect to Azure CosmosDB')
    .command('dispatch', 'connect to a Dispatch model')
    .command('endpoint', 'connect to endpoint')
    .command('file', 'connect to file to the bot')
    .command('generic', 'connect to generic service configuration')
    .command('luis', 'connect to a LUIS application')
    .command('qna', 'connect to QNA a service');
const args = program.parse(process.argv);
// args should be undefined is subcommand is executed
if (args) {
    const a = process.argv.slice(2);
    console.error(chalk.default.redBright(`Unknown arguments: ${a.join(' ')}`));
github MarcusCemes / responsive-image-builder / bin / index.js View on Github external
const gradient = platform !== "win32" ? require("gradient-string")
  ([{color: '#2193b0', pos: 0},{color: '#6dd5ed', pos: 1}]).multiline : v => v;
const indent = require("indent-string");

function intParser(input) {
  if (typeof input === "string" && input.length > 0) return parseInt(input);
  return undefined;
}

const header = indent(gradient(`   ______   _____ _______
  (, /   ) (, /  (, /    )
    /__ /    /     /---(
 ) /   \\____/__ ) / ____)
(_/    (__ /   (_/ (`, { interpolation: "hsv" }), 10);

program
  .name("rib")
  .description(`${header}

  Responsive Image Builder - https://git.io/fjvL7

  An ultra-fast WebP build pipeline, for the web!\x1b[?25h`) // Show the cursor if help is displayed
  .usage("-i  -o 
github alibaba / funcraft / bin / fun-nas-sync.js View on Github external
const getVisitor = require('../lib/visitor').getVisitor;
const notifier = require('../lib/update-notifier');
const commaSeparatedList = (value, dummyPrevious) => {
  return value.split(',');
};

const examples =
  `
  Examples:

    $ fun nas sync
    $ fun nas sync -s nas_demo_service
    $ fun nas sync -s nas_demo_service -m /mnt/auto
  `;

program
  .name('fun nas sync')
  .usage('[options]')
  .description('Upload local NAS to remote NAS automatically')
  .option('-s, --service ', 'Upload the local NAS belonging to the specified service')
  .option('-m, --mount-dir ', 'Upload the local NAS corresponding to the specified mount directory', commaSeparatedList)
  .on('--help', () => {
    console.log(examples);
  })
  .parse(process.argv);

program.parse(process.argv);

notifier.notify();

getVisitor().then(visitor => {
  visitor.pageview('/fun/nas/sync').send();
github microsoft / botbuilder-tools / MSBot / bin / msbot-connect-generic.js View on Github external
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
 * Copyright(c) Microsoft Corporation.All rights reserved.
 * Licensed under the MIT License.
 */
const botframework_config_1 = require("botframework-config");
const chalk = require("chalk");
const program = require("commander");
program.Command.prototype.unknownOption = function (flag) {
    console.error(chalk.default.redBright(`Unknown arguments: ${flag}`));
    showErrorHelp();
};
program
    .name('msbot connect generic')
    .description('Connect a generic service to the bot')
    .option('-n, --name ', 'name of the service')
    .option('-u, --url ', 'deep link url for the service\n')
    .option('--keys ', 'serialized json key/value configuration for the service')
    .option('-b, --bot 
github theolampert / naos / src / cli.ts View on Github external
const pwd = process.env.PWD;
const pkg = require('../package.json');

let configPath: string = path.join(pwd, './naos-config.json');
let reporterFormat = 'pretty';

const config = (val: string) => {
  configPath = path.join(pwd, val);
}

const format = (val: string) => {
  reporterFormat = val;
}

program
  .name(pkg.name)
  .version(pkg.version)
  .option('-c, --config ', 'Specify a naos-config.json file.', config)
  .option('-f, --format ', 'Specify a format [ pretty (default), json ].', format)
  .parse(process.argv);

  const configFile = require(configPath);
  run(configFile, reporterFormat);
github ajhsu / chromecast-device-emulator / src / cli / index.js View on Github external
#!/usr/bin/env node

const program = require('commander');
const manifest = require('../../package.json');
const { log, error } = require('../log');
const { startEmulator } = require('./app');

program
  .name(manifest.name)
  .version(manifest.version, '-v, --version')
  .usage('start ');

/**
 * Defaults to help command
 */
if (!process.argv.slice(2).length) {
  program.outputHelp();
}

/**
 * start command
 */
program
  .command('start ')
github jonaslu / sider / sider-engine.js View on Github external
commander
    .command(engine.getconf.commanderLine)
    .description('lists stored and default config on an engine')
    .action(getConfig);

  commander
    .command(engine.setconf.commanderLine)
    .description('sets config(s) on an engine')
    .action(setConfig);

  commander
    .command(engine.remconf.commanderLine)
    .description('removes config(s) on an engine')
    .action(removeConfig);

  commander
    .name('sider engine')
    .description('controls dbs')
    .usage(' [arguments]');
}
github expo / expo-cli / packages / expo-cli / src / exp.ts View on Github external
function generateCommandJSON() {
  program.name('expo');
  registerCommands(program);
  return program.commands.map(commandAsJSON);
}