How to use the commander.host 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 erha19 / weex-debugger / bin / weex-devtool.js View on Github external
config.CHANNELID = program.channelid
}

// Get the local environment
env.getVersionOf('weex', (v) => {
  config.weexVersion = v && v.version;
})
env.getVersionOf('npm', (v) => {
  config.npmVersion = v &&  v.version;
})
env.getVersionOf('node', (v) => {
  config.nodeVersion = v && v.version;
})

// Formate config 
config.ip = program.host || ip.address();
config.manual = program.manual;
config.min = program.min;
config.ext = program.ext || 'vue';

process.on('uncaughtException', (err) => {
  try {
    let killTimer;
    const params = Object.assign({
      stack: err && err.stack,
      os: os.platform(),
      node: config.nodeVersion,
      npm: config.npmVersion
    }, config.weexVersion);
    killTimer = setTimeout(function () {
      process.exit(1);
    }, 30000);
github caprover / caprover / app-cli / captainduckduck-deploy.js View on Github external
let defaultInvalid = false;

if (program.default) {

    if (!getDefaultMachine() || !getPropForDirectory(BRANCH_TO_PUSH) || !getPropForDirectory(APP_NAME)) {
        console.log('Default deploy failed. Please select deploy options.');
        defaultInvalid = true;
    }
    else {
        console.log('Deploying to ' + getPropForDirectory(MACHINE_TO_DEPLOY).name);
        deployTo(getPropForDirectory(MACHINE_TO_DEPLOY), getPropForDirectory(BRANCH_TO_PUSH), getPropForDirectory(APP_NAME));
    }

}

const isStateless = program.stateless && program.host && program.appName && program.pass;

if (isStateless) {
    // login first
    console.log('Trying to login to', program.host)
    requestLoginAuth(program.host, program.pass, function (authToken) {
        // deploy
        console.log('Starting stateless deploy to', program.host, program.branch, program.appName);
        deployTo({
            baseUrl: program.host,
            authToken,
        }, program.branch || 'master', program.appName);
    });
}
else if (!program.default || defaultInvalid) {

    inquirer.prompt(questions).then(function (answers) {
github i5ting / upload-anywhere / bin / client.js View on Github external
var argv = process.argv;
var up_file = argv[2];

// - uci -h 127.0.0.1 -p 3456 -f file 

var program = require('commander');

program
  .version('0.0.1')
  .option('-b, --bbq-sauce', 'Add bbq sauce')
  .option('-h, --host [host]', 'Add host [marble]', '127.0.0.1')
  .option('-p, --port [port]', 'Add port [port]', '3456')
  .option('-f, --file [file]', 'Add file [marble]')
  .parse(process.argv);

if (program.host) {
  console.log('host=' + program.host);
}else{
  program.host = '127.0.0.1';
}

if (program.file) {
  console.log('file=' + program.file);
}else{
  if(up_file[0] != '-'){
    program.file = up_file;
    console.log('file=' + program.file);
  }else{
    console.log('file not exist, please add -f or --file') 
  }
}
github zubairq / pilot / src / electron.js View on Github external
function setupVisifileParams() {
    typeOfSystem = program.type;
    centralHostAddress = program.host;
    centralHostPort = program.hostport;
    if (!isNumber(centralHostPort)) {centralHostPort = 80;};


    if (!(typeOfSystem == 'client' || typeOfSystem == 'server')) {
        console.log('-------* Invalid system type: ' + typeOfSystem);
        process.exit();
    };
    if (showDebug) {
        console.log('-------* System type: ' + typeOfSystem);
        console.log('-------* Port: ' + port);
        console.log('-------* Central host: ' + centralHostAddress);
        console.log('-------* Central host port: ' + centralHostPort);


       console.dir ( ip.address() );
github moon0326 / swagger-ui-watcher / bin / swagger-ui-watcher.js View on Github external
}

if (typeof targetDirValue === 'undefined') {
    try {
        targetDirValue = findParentDir.sync(path.dirname(swaggerFileValue), path.basename(swaggerFileValue));
    } catch (err) {
        console.error(`Failed to resolve [targetDir]/${swaggerFileValue}.\n${help}`);
        process.exit(1);
    }
}

if (typeof program.port === 'undefined') {
    program.port = 8000;
}

if (typeof program.host === 'undefined') {
    program.host = "127.0.0.1";
}

if (typeof program.bundle === 'undefined') {
    program.bundle = null;
}

if (program.bundle === swaggerFileValue) {
    console.error(" value cannot be same as  value.");
    process.exit(1);
}

if (!fs.existsSync(targetDirValue)) {
    console.error(targetDirValue + " does not exist.");
    process.exit(1);
}
github moon0326 / swagger-ui-watcher / bin / swagger-ui-watcher.js View on Github external
if (!fs.existsSync(targetDirValue)) {
    console.error(targetDirValue + " does not exist.");
    process.exit(1);
}

if (!fs.existsSync(swaggerFileValue)) {
    console.error(swaggerFileValue + " does not exist.");
    process.exit(1);
}

if (program.bundle === null) {
    require("../index.js").start(
        swaggerFileValue,
        targetDirValue,
        program.port,
        program.host
    );
} else {
    require("../index.js").build(
        swaggerFileValue,
        targetDirValue,
        program.bundle
    );
}
github gmalysa / db-filters / generate.js View on Github external
function show_summary(env, after) {
		console.log(s('\nOption Summary', colors.header));
		console.log(s('MySQL host ', colors.text) + s(c.host, colors.param));
		console.log(s('MySQL user ', colors.text) + s(c.user, colors.param));
		console.log(s('MySQL pass ', colors.text) + s('(hidden)', ['red']));
		console.log(s('Database to process ', colors.text) + s(c.database, colors.param));
		console.log(s('Output directory ', colors.text) + s(c.output, colors.param));
		if (c.all)
			console.log(s('Processing all tables', colors.text));
		else
			console.log(s('Prompting for tables', colors.text));
		c.prompt(s('\nPress enter to continue, or ctrl+c to cancel', colors.header)+' ', after);
	},
	function generate(env, after, input) {
github ChiChou / bagbak / go.js View on Github external
program.parse(process.argv)

  if (program.uuid && program.host)
    throw new Error('Use either uuid or host')

  if (program.args.length > 1)
    throw new Error('For stability, only decrypt one app once')

  if (program.list && program.args.length)
    throw new Error('Invalid command')

  let device = null
  if (program.uuid)
    device = await Device.find(program.uuid)
  else if (program.host)
    device = await Device.connect(program.host)
  else
    device = await Device.usb()

  if (program.list) {
    const list = await device.dev.enumerateApplications()
    for (let app of list) {
      delete app.smallIcon
      delete app.largeIcon
    }
    console.table(list)
    return
  }

  if (program.args.length === 1) {
    const app = program.args[0]
github zubairq / pilot / src / electron.js View on Github external
.option('-a, --runapp [runapp]', 'Run the app with ID as the homepage (default not set) [runapp]', null)
      .option('-u, --loadjsurl [loadjsurl]', 'Load the following JS from a URL (default not set) [loadjsurl]', null)
      .option('-f, --loadjsfile [loadjsfile]', 'Load the following JS from a file (default not set) [loadjsfile]', null)
      .option('-z, --loadjscode [loadjscode]', 'Load the following JS from the command line (default not set) [loadjscode]', null)
      .option('-b, --runhtml [runhtml]', 'Run using a local HTML page as the homepage (default not set) [runhtml]', null)
      .option('-q, --https [https]', 'Run using a HTTPS (default is http) [https]', 'false')
      .option('-v, --private [private]', 'Private HTTPS key [private]', null)
      .option('-c, --public [public]', 'Public HTTPS certificate [public]', null)
      .option('-e, --cacert1 [cacert1]', 'Public HTTPS CA certificate 1 [cacert1]', null)
      .option('-f, --cacert2 [cacert2]', 'Public HTTPS CA certificate 2 [cacert2]', null)
      .option('-g, --cacert3 [cacert3]', 'Public HTTPS CA certificate 3 [cacert3]', null)
      .option('-u, --usehost [usehost]', 'Use host name [usehost]', null)
      .parse(process.argv);
} else {
    program.type = 'client'
    program.host = 'yazz.com'
    program.locked = 'true'
    program.debug = 'false'
    program.deleteonexit = 'true'
    program.deleteonstartup = 'false'
    program.runapp = null
    program.loadjsurl = null
    program.loadjsfile = null
    program.runhtml = null
    program.https = 'false'
    program.usehost = null
}
var semver = require('semver')

var showDebug = false
if (program.showdebug == 'true') {
    showDebug = true;