How to use the rawArgs function from commander
Find comprehensive JavaScript commander.rawArgs code examples handpicked from public code repositorys.
GitHub: sourcey/spectacle
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')
335
0
19
+ 15 other calls in file
GitHub: wuhaocn/coral-draw
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; }
17
17
0
GitHub: ITV/pmpact
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(); }
3
15
0
+ 9 other calls in file
GitHub: alibaba/f2etest
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(){
635
0
237
GitHub: wangjeaf/ckstyle-node
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()
8
61
8
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
78
44
14
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; }
1
24
0
+ 15 other calls in file
GitHub: savemeour/1234
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; }
0
0
1
+ 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); }
0
0
0
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) {
0
0
2
+ 3 other calls in file
commander.Option is the most popular function in commander (1786 examples)