How to use the parseOptions function from commander

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

88
89
90
91
92
93
94
95
96
97
// HACK: avoid commander.js's bug
// (https://github.com/visionmedia/commander.js/pull/121)
// program.parse() doesn't fail when unknown option and args are given.
// So we call program.parseOptions() instead of program.parse().
program._name = 'livereloadx';
var parsed = program.parseOptions(program.normalize(argv.slice(2)));
program.args = parsed.args;

// handle unknown options
if (parsed.unknown.length > 0) {
fork icon27
star icon199
watch icon8

+ 3 other calls in file

43
44
45
46
47
48
49
50
51
  // in this particular case so let's be explicit about that.
  // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseInt
  return parseInt(string, 10)
}

const parsedArgs = program.parseOptions(process.argv)

program
  .version(process.env.npm_package_version)
fork icon734
star icon0
watch icon109

162
163
164
165
166
167
168
169
170
171
            : indent + o.description);
    });
    console.log("tslint accepts the following commandline options:\n\n    " + optionDetails.join("\n\n    ") + "\n\n");
});
// Hack to get unknown option errors to work. https://github.com/visionmedia/commander.js/pull/121
var parsed = commander.parseOptions(process.argv.slice(2));
commander.args = parsed.args;
if (parsed.unknown.length !== 0) {
    commander.parseArgs([], parsed.unknown);
}
fork icon0
star icon0
watch icon1

+ 31 other calls in file

Other functions in commander

Sorted by popularity

function icon

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