source: trip-planner-front/node_modules/yargs/index.js@ 1ad8e64

Last change on this file since 1ad8e64 was e29cc2e, checked in by Ema <ema_spirova@…>, 3 years ago

primeNG components

  • Property mode set to 100644
File size: 860 bytes
RevLine 
[6a3a178]1'use strict'
2// classic singleton yargs API, to use yargs
3// without running as a singleton do:
4// require('yargs/yargs')(process.argv.slice(2))
5const yargs = require('./yargs')
6
7Argv(process.argv.slice(2))
8
9module.exports = Argv
10
11function Argv (processArgs, cwd) {
12 const argv = yargs(processArgs, cwd, require)
13 singletonify(argv)
14 return argv
15}
16
17/* Hack an instance of Argv with process.argv into Argv
18 so people can do
19 require('yargs')(['--beeble=1','-z','zizzle']).argv
20 to parse a list of args and
21 require('yargs').argv
22 to get a parsed version of process.argv.
23*/
24function singletonify (inst) {
25 Object.keys(inst).forEach((key) => {
26 if (key === 'argv') {
27 Argv.__defineGetter__(key, inst.__lookupGetter__(key))
28 } else {
29 Argv[key] = typeof inst[key] === 'function' ? inst[key].bind(inst) : inst[key]
30 }
31 })
32}
Note: See TracBrowser for help on using the repository browser.