1 // classic singleton yargs API, to use yargs
2 // without running as a singleton do:
3 // require('yargs/yargs')(process.argv.slice(2))
4 const yargs = require('./yargs')
6 Argv(process.argv.slice(2))
10 function Argv (processArgs, cwd) {
11 const argv = yargs(processArgs, cwd, require)
16 /* Hack an instance of Argv with process.argv into Argv
18 require('yargs')(['--beeble=1','-z','zizzle']).argv
19 to parse a list of args and
21 to get a parsed version of process.argv.
23 function singletonify (inst) {
24 Object.keys(inst).forEach(function (key) {
26 Argv.__defineGetter__(key, inst.__lookupGetter__(key))
28 Argv[key] = typeof inst[key] === 'function' ? inst[key].bind(inst) : inst[key]