How to use the commander.usage 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 SUI-Components / sui / packages / sui-widget-embedder / bin / sui-widget-embedder-dev.js View on Github external
#!/usr/bin/env node
/* eslint no-console:0 */
const program = require('commander')
const ncp = require('copy-paste')

const appFactory = require('../development')
let config =
  require(`${process.cwd()}/package.json`)['config']['sui-widget-embedder'] ||
  {}

const PORT = process.env.PORT || config.devPort || 3000
config.port = PORT

program
  .usage('-p detail -a address')
  .option('-p, --page ', 'Name of the page')
  .option(
    '-a, --address ',
    'Local ip address to lookup statics, useful for virtual machines',
    'localhost'
  )
  .on('--help', () => {
    console.log('  Description:')
    console.log('')
    console.log('  Start a development server')
    console.log('')
    console.log('  Examples:')
    console.log('')
    console.log('    $ sui-widget-embedder development --page detail')
    console.log(
github khangiskhan / swagger-commander / lib / apiCommander.js View on Github external
function setupParentcommand(processArgs, apis) {
    _.each(apis, function (api, apiKey) {
        // Ignore the help apiKey returned by SwaggerClient
        if (apiKey !== 'help') {
            createCommandForApi(api, apiKey);
        }
    });

    commander
        .usage('[parent-command] [options]');

    commander.on('--help', function () {
        configHelp();
    });

    // Use our customHelp when -h/--help is used
    commander.outputHelp = commander.outputHelp.bind(commander, customHelp);

    // *** We specify this option here, but it is handled in apiOperationCommander.js
    commander
        .option('-E, --expandOperations', 'Show detailed help for every sub-command under [parent-command]');

    commander.parse(processArgs);
    //console.log(chalk.green(splash.ascii) + '\n');
    commander.help(customHelp);
github DonaldHays / event-aurora / musicc / musicc.js View on Github external
"use strict";

const path = require("path");
const fs = require("fs");
const commander = require("commander");
const formatter = require("./formatter");

commander
  .usage("[options]  ")
  .option("-b, --bank [value]", "The output bank", "0")
  .parse(process.argv);

if(commander.args.length != 2) {
  console.error("must provide input and output files");
  process.exit(1);
}

const inputFilePath = path.resolve(commander.args[0]);
const outputFilePath = path.resolve(commander.args[1]);
const outputHeaderPath = outputFilePath.substr(0, outputFilePath.length - path.extname(outputFilePath).length) + ".h";

const noteNames = [
  ["c"],
  ["c#", "db"],
github creationix / jsgit / bin / ls-remote.js View on Github external
#!/usr/bin/env node
var git = require('git-node');
var program = require('commander');

program
  .usage('')
  .parse(process.argv);

if (program.args.length < 1 || program.args.length > 2) {
  program.outputHelp();
  process.exit(1);
}

if (program.args.length != 1) {
  program.outputHelp();
  process.exit(1);
}

var url = program.args[0];
var remote = git.remote(url);
remote.discover(function (err, refs) {
github node-machine / machinepack / bin / machinepack-info.js View on Github external
#!/usr/bin/env node

/**
 * Module dependencies
 */

var util = require('util');
var program = require('commander');
var _ = require('lodash');
var chalk = require('chalk');
var Javascript = require('machinepack-javascript');
var Machinepacks = require('machinepack-localmachinepacks');



program
  .usage('[options]')
  .parse(process.argv);



Machinepacks.readPackageJson({
  dir: process.cwd()
}).exec({
  error: function(err) {
    console.error('Unexpected error occurred:\n', err);
  },
  notMachinepack: function() {
    console.error('This is ' + chalk.red('not a machinepack') + '.');
    console.error('Be sure and check that the package.json file has a valid `machinepack` property, or run `machinepack init` if you aren\'t sure.');
  },
  success: function(machinepack) {
github ali322 / nva / bin / nva-init.js View on Github external
#! /usr/bin/env node

const program = require('commander')
const chalk = require('chalk')
const path = require('path')
const fs = require('fs')
const inquirer = require('inquirer')
const rm = require('rimraf').sync

const config = require('../lib/config')
const generator = require('../lib/generator')
const { ask } = require('../lib')

program.usage('[project]')
program.option('-r, --repo [value]', 'choose specified repo')
program.option('--no-install', 'do not execute npm install')
program.option('--yarn', 'use yarn instead of npm')

program.on('--help', function () {
  console.log(`
  Examples:

    ${chalk.cyan(' # create a new project by specified template')}
    nva init Todo
    
    ${chalk.cyan(' # create a new project by specified github repo')}
    nva init Todo -r ali322/frontend-scaffold

    `)
})
github denali-js / core / dist / cli / commands / server.js View on Github external
import { sync as copyDereferenceSync } from 'copy-dereference';

/**
 * The server command is responsible for launching the Denali app. It will
 * compile the app via broccoli and run the result.
 *
 * The app itself is launched as a child process. The app is started by reaching
 * into it's installation of denali (inside node_modules/denali) and running the
 * bootstrap.js script.
 *
 * This script then loads the compiled app (whose location is specified by the
 * server command process as an arg to the bootstrap script). From there, an
 * Application is instantiated and the runtime takes over.
 */

program
.usage('[options]')
.description('Runs the denali server for local or production use')
.option('-e --environment ', 'The environment to run under, i.e. "production"', String)
.option('-d --debug', 'Runs the server with the node --debug flag, and launches node-inspector')
.option('-w --watch', 'Watches the source files and restarts the server on changes (enabled by default in development)')
.option('-p, --port ', 'Sets the port that the server will listen on')
.parse(process.argv);

let environment = program.environment || process.env.NODE_ENV || process.env.DENALI_ENV || 'development';
let watch = environment === 'development' || program.watch;

let command = 'node';
let args = [ 'node_modules/denali/dist/bootstrap.js', path.join(process.cwd(), 'dist') ];
let options = {
  stdio: [ 'pipe', process.stdout, process.stderr ],
  cwd: process.cwd()
github xiaojue / fd-server / bin / fdserver.js View on Github external
#!/usr/bin/env node
var fds = require("../lib/commanders.js");
var pkg = require('../package.json');
var program = require('commander');

program.version(pkg.version);

program.usage('[command]');

var key;

for (key in fds.commanders) {
	var commander = fds.commanders[key];
	program.command(key).description(commander['description']).action(commander['exec']);
}

program.parse(process.argv);

if (!program.args.length){
	program.help();
}
github Blackgan3 / WeChat / node_modules / _babel-cli@6.26.0@babel-cli / lib / babel / index.js View on Github external
commander.option(arg, desc.join(" "));
});

commander.option("-x, --extensions [extensions]", "List of extensions to compile when a directory has been input [.es6,.js,.es,.jsx]");
commander.option("-w, --watch", "Recompile files on changes");
commander.option("--skip-initial-build", "Do not compile files before watching");
commander.option("-o, --out-file [out]", "Compile all input files into a single file");
commander.option("-d, --out-dir [out]", "Compile an input directory of modules into an output directory");
commander.option("-D, --copy-files", "When compiling a directory copy over non-compilable files");
commander.option("-q, --quiet", "Don't log anything");


var pkg = require("../../package.json");
commander.version(pkg.version + " (babel-core " + require("babel-core").version + ")");
commander.usage("[options] ");
commander.parse(process.argv);

if (commander.extensions) {
  commander.extensions = util.arrayify(commander.extensions);
}

var errors = [];

var filenames = commander.args.reduce(function (globbed, input) {
  var files = glob.sync(input);
  if (!files.length) files = [input];
  return globbed.concat(files);
}, []);

filenames = uniq(filenames);
github danger / danger-js / source / commands / danger-ci.ts View on Github external
#! /usr/bin/env node

import program from "commander"

import setSharedArgs, { SharedCLI } from "./utils/sharedDangerfileArgs"
import { runRunner } from "./ci/runner"

program.usage("[options]").description("Runs a Dangerfile in JavaScript or TypeScript.")
setSharedArgs(program).parse(process.argv)

const app = (program as any) as SharedCLI
runRunner(app)