2 // classic singleton yargs API, to use yargs
3 // without running as a singleton do:
4 // require('yargs/yargs')(process.argv.slice(2))
5 const yargs = require('./yargs')
7 Argv(process.argv.slice(2))
11 function Argv (processArgs, cwd) {
12 const argv = yargs(processArgs, cwd, require)
17 /* Hack an instance of Argv with process.argv into Argv
19 require('yargs')(['--beeble=1','-z','zizzle']).argv
20 to parse a list of args and
22 to get a parsed version of process.argv.
24 function singletonify (inst) {
25 Object.keys(inst).forEach((key) => {
27 Argv.__defineGetter__(key, inst.__lookupGetter__(key))
29 Argv[key] = typeof inst[key] === 'function' ? inst[key].bind(inst) : inst[key]