How to use the commander.verbose 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 mikefrey / node-pac / index.js View on Github external
console.log('');
  console.log('    $ pac -P install');
  console.log('    $ pac grunt');
  console.log('    $ pac -s bower install');
  console.log('    $ pac -s bower angular');
  console.log('');
});

program.parse(process.argv);

// Determine which strategy to use
var strategy;
if (program.strategy === 'bower') {
  strategy = new BowerStrategy({
    mode: program.production ? 'production' : 'develop',
    verbose: program.verbose ? true : false
  });
} else if (program.strategy === 'npm') {
  strategy = new NpmStrategy({
    mode: program.production ? 'production' : 'develop',
    verbose: program.verbose ? true : false
  });
} else {
  console.error('Specified strategy is not supported');
  process.exit(1);
}

if (program.install) {
  strategy.install();
} else {
  if (program.args >= 1) {
    program.args.forEach(function(module) {
github janjongboom / mbed-simulator / cli.js View on Github external
const outputDir = Path.dirname(program.outputFile);

helpers.mkdirpSync(outputDir);

// extra arguments that are passed in, but need to remove ones already covered in program...
let extraArgs = (program.compilerOpts || '').split(' ');

let fn = program.inputDir ? application.buildDirectory : application.buildFile;

if (program.skipBuild) {
    console.log('Skipping build...');
    fn = () => Promise.resolve();
}

fn(program.inputDir || program.inputFile, program.outputFile, extraArgs, program.emterpretify, program.verbose)
    .then(async function() {
        console.log('Building application succeeded, output file is', program.outputFile);

        if (program.launch || program.launchHeadless) {
            let browser;
            try {
                let port = process.env.PORT || 7900;
                let logsEnabled = !program.disableRuntimeLogs;
                await promisify(launchServer)(outputDir, port, 0, logsEnabled);

                let name = Path.basename(program.outputFile, '.js');

                if (program.launch) {
                    opn(`http://localhost:${port}/view/${name}`);
                }
                else if (program.launchHeadless) {
github SimpliField / miniquery / bin / miniquery.js View on Github external
}());
  process.exit();
}

// Query is required
if(!query) {
  console.error('No query given in argument!');
  process.exit(1);
}

// Default to stdin
if(!pathes.length) {
  pathes = ['/dev/stdin'];
}

program.verbose = false;
pathes.reduce(function(matches, filePath) {
  var content;
  var curMatches;
  program.verbose && console.log('[' + filePath + '] Parsing...');
  try {
    content = JSON.parse(fs.readFileSync(filePath, 'utf8'));
  } catch(err) {
    console.error('[' + filePath + '] Couldn\'t access/parse the file...', err);
  }
  if(!content) {
    return matches;
  }
  curMatches = miniquery(query, [content]);
  program.verbose && console.log('[' + filePath + '] ' + (curMatches.length) +
    ' match ' + (curMatches.length > 1 ? 's' : '') + '.');
  return matches.concat(curMatches);
github cdaringe / revealer / src / app.js View on Github external
'provide a directory to `--source [dir]` or create a `src` dir'
      ].join(' ')
    )
  }
}

// prep app constants
const CONSTANTS = {
  APP_ROOT: appRoot,
  BUILD_DIR: app.build,
  SRC_DIR: app.src,
  REVEAL_DIR: path.join(appRoot, 'node_modules', 'reveal.js'),
  IS_WIN: /^win/.test(os.platform())
}
Object.assign(app, CONSTANTS)
if (app.verbose) logger.verbose(CONSTANTS)

module.exports = app
github artlogic / nabs / index.js View on Github external
log.info('Writing %s...', pkgFile);
  jsonfile.writeFileSync('package.json', pkg, {
    encoding: 'utf8',
    spaces: 2,
  });
};

program
  .version(version)
  .option('-d, --disable', 'disable the default nabs regenerate task')
  .option('-n, --nabs ', 'nabs.yml file (defaults to nabs.yml in current dir)')
  .option('-p, --package ', 'package.json file (defaults to package.json in current dir)')
  .option('-v, --verbose', 'pass up to 3 times to increase verbosity', (v, total) => total + 1, 0)
  .parse(process.argv);

log.level = logLevels[program.verbose || 0];

if (!module.parent) {
  // we've been run directly
  log.info('Starting nabs v%s', version);

  try {
    nabs.main(program);
  } catch (e) {
    log.error(e.message);
    log.debug(e);
    process.exit(1);
  }
} else {
  // we've been imported - just expose the machinery
  module.exports = nabs;
}
github M6Web / websocket-bench / index.js View on Github external
.option('-v, --verbose', 'Verbose Logging')
  .parse(process.argv);

if (program.args.length < 1) {
  program.help();
}

var server = program.args[0];

// Set default value
if (!program.worker) {
  program.worker = 1;
}

if (!program.verbose) {
  program.verbose = false;
}

if (!program.amount) {
  program.amount = 100;
}

if (!program.concurency) {
  program.concurency = 20;
}

if (!program.generator) {
  program.generator = __dirname + '/lib/generator.js';
}

if (program.generator.indexOf('/') !== 0) {
  program.generator = process.cwd() + '/' + program.generator;
github kyleschaeffer / engineer / src / Engineer.ts View on Github external
// No config file found
  if (!options) {
    Log.fail({
      key: 'config.failed',
      tokens: { path: File.path(path) },
    });
  }

  // Load environment config
  _.merge(Env, options);

  // Logging mode
  if (program.quiet) Env.logLevel = LogLevel.Off;
  if (program.info) Env.logLevel = LogLevel.Info;
  if (program.verbose) Env.logLevel = LogLevel.Verbose;

  // Using
  Log.info({
    level: LogLevel.Info,
    key: 'config.using',
    tokens: { path: File.path(path) },
  });

  // Subscribe to @pnp/logging
  Log.subscribe();
};
github tom-james-watson / dat-cp / src / dcp.js View on Github external
program
  .version(pkgJson.version)
  .usage('[options] {files ... | key}')
  .description('Dat Copy - remote file copy, powered by the dat protocol.')
  .option('-r, --recursive', 'recursively copy directories')
  .option('-n, --dry-run', 'show what files would have been copied')
  .option('-v, --verbose', 'verbose mode - prints extra debugging messages')
  .parse(process.argv)

if (!process.argv.slice(2).length || !program.args.length) {
  program.outputHelp()
  process.exit(1)
}

if (program.verbose) {
  logger.enableDebug()
}

if (program.args[0].length === 64) {
  receive(program.args[0], program)
} else {
  send(program.args, program)
}

process.on('unhandledRejection', (reason, promise) => {
  console.error({reason, promise})
})
github haeric / bailey.js / src / cli.js View on Github external
program
    .version(bailey.version)
    .usage('<source> ')
    .option('-n, --node', 'Use node imports instead of requirejs-imports.')
    .option('-b, --bare', 'Make the Javascript file without the wrapper function.')
    .option('-w, --watch', 'Watch the source file or directory, recompiling when any file changes.')
    .option('-v, --verbose', 'More detailed output')
    .option('--remove-comments', 'Remove all comments in the compiled version.')
    .option('--carebear', 'Do not care about style guide errors. Shame on you.')
    .option('--optimize', 'Remove debug checks for types (types are experimental)')
    .option('--eval [input]', '')
    .option('-c, --config [input]', 'Configs you want to run, seperated by comma.')
    .option('--stdio', '')
    .parse(process.argv);

if (program.verbose) {
    Bluebird.longStackTraces();
}

runTasks(program);

function runTasks(program) {
    var options = {
        node: false,
        bare: false,
        removeComments: false,
        strictStyleMode: true,
        optimize: false,
        config: 'default'
    };

    if (!program.args.length) {
github cgiffard / Behaviour-Assertion-Sheets / lib / cli.js View on Github external
csvEscape(error.message) +
			"\n";
	}

	for (var key in input) {
		if (!input.hasOwnProperty(key)) continue;

		if (!(input[key] instanceof Array && input[key].length)) continue;

		input[key].forEach(writeLine);
	}

	return csvOut;
}

if (basCLI.verbose) {
	testSuite.on("start",function(url) {
		log("\tCommencing BAS test suite");
	});

	testSuite.on("startgroup",function(rule) {
		log("\tStarting test group: " + String(rule).yellow);
	});

	testSuite.on("selector",function(selector) {
		log("\t\tTesting selector " + String(selector).yellow);
	});

	testSuite.on("assertion",function(assertion) {
		log("\t\t\tTesting assertion " + String(assertion).yellow);
	});