How to use the rawArgs function from commander

Find comprehensive JavaScript commander.rawArgs code examples handpicked from public code repositorys.

28
29
30
31
32
33
34
35
36
37
    .option('-q, --quiet', 'Silence the output from the generator (default: false)')
    // .option('-f, --spec-file <file>', 'the input OpenAPI/Swagger spec file (default: test/fixtures/petstore.json)', String, 'test/fixtures/petstore.json')
    .parse(process.argv)

// Show help if no specfile or options are specified
if (program.args.length < 1) { // && program.rawArgs.length < 1
    program.help()
}

program.specFile = program.args[0]; // || path.resolve(root, 'test/fixtures/cheese.json')
fork icon335
star icon0
watch icon19

+ 15 other calls in file

478
479
480
481
482
483
484
485
486
487
		dummyWin.destroy();
   	}
   	
   	return;
}
   else if (program.rawArgs.indexOf('-h') > -1 || program.rawArgs.indexOf('--help') > -1) //To prevent execution when help arg is used
{
   	return;
}
   
fork icon17
star icon17
watch icon0

41
42
43
44
45
46
47
48
49
50
    console.log('');
});

program.parse(process.argv);

const NO_COMMAND = program.rawArgs.length < 3;

if (NO_COMMAND) {
    program.help();
}
fork icon3
star icon15
watch icon0

+ 9 other calls in file

73
74
75
76
77
78
79
80
81
82
    });

var startCommand = program.command('start')
    .description('start local proxy in daemon')
    .action(function(options){
        var rawArgs = program.rawArgs;
        var nodePath = rawArgs.shift();
        rawArgs[1] = 'run';

        killOldProxy(function(){
fork icon635
star icon0
watch icon237

38
39
40
41
42
43
44
45
46
47
exports.command = function(args) {
  loadCommands()

  commander.parse(args)

  var rawArgs = commander.rawArgs
  // rawArgs示例:[ 'node', '/usr/local/bin/ckstyle', 'demo' ]

  if (rawArgs.length == 2) {
    commander.help()
fork icon8
star icon61
watch icon8

62
63
64
65
66
67
68
69
70
    .split('-')
    .reduce((str, word) => str + word[0].toUpperCase() + word.slice(1));

// Now we must think which arguments passed to cli must be passed down to
// parity.
const parityArgv = cli.rawArgs
  .splice(2) // Remove first 2 arguments which are program path
  .filter((item, index, array) => {
    const key = camelcase(item.replace('--', '').replace('no-', '')); // Remove '--' and then camelCase
fork icon78
star icon44
watch icon14

648
649
650
651
652
653
654
655
656
657
		dummyWin.destroy();
   	}
   	
   	return;
}
   else if (program.rawArgs.indexOf('-h') > -1 || program.rawArgs.indexOf('--help') > -1 || program.rawArgs.indexOf('-V') > -1 || program.rawArgs.indexOf('--version') > -1) //To prevent execution when help/version arg is used
{
	app.quit();
   	return;
}
fork icon1
star icon24
watch icon0

+ 15 other calls in file

243
244
245
246
247
248
249
250
251
252
 * Patch Commander.js Variadic feature
 */
function patchCommanderArg(cmd) {
  var argsIndex;
  if ((argsIndex = commander.rawArgs.indexOf('--')) >= 0) {
    var optargs = commander.rawArgs.slice(argsIndex + 1);
    cmd = cmd.slice(0, cmd.indexOf(optargs[0]));
  }
  return cmd;
}
fork icon0
star icon0
watch icon1

+ 5 other calls in file

458
459
460
461
462
463
464
465
466
467

try {
  var counter = 0;
  var realFileName = outFileName;

  if (program.rawArgs.indexOf("-k") > -1 || program.rawArgs.indexOf("--check") > -1) {
    while (fs.existsSync(realFileName)) {
      counter++;
      realFileName = path.join(path.dirname(outFileName), path.basename(outFileName, path.extname(outFileName))) + "-" + counter + path.extname(outFileName);
    }
fork icon0
star icon0
watch icon0

61
62
63
64
65
66
67
68
69
70
// if (appConf['exec_mode'] == 'cluster_mode' && process.version.match(/0.10/)) {
//   console.log(cst.PREFIX_MSG_ERR + ' [Warning], you\'re using the 0.10.x node version, it\'s prefered that you switch to fork mode by adding the -x parameter.');
// }

// Script arguments
var env = commander.rawArgs.indexOf('--') + 1;
if (env > 1)
  appConf['args'] = JSON.stringify(commander.rawArgs.slice(env, commander.rawArgs.length));

if (commander.write) {
fork icon0
star icon0
watch icon2

+ 3 other calls in file

Other functions in commander

Sorted by popularity

function icon

commander.Option is the most popular function in commander (1786 examples)