aboutsummaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/yargs/index.js
diff options
context:
space:
mode:
authorRebecca Turner <me@re-becca.org>2018-04-20 18:26:37 -0700
committerRebecca Turner <me@re-becca.org>2018-05-24 23:24:45 -0700
commit468ab4519e1b92473acefb22801497a1af6aebae (patch)
treebdac1d062cd4b094bde3a21147bab5d82c792ece /deps/npm/node_modules/yargs/index.js
parentac8226115e2192a7a46ba07789fa5136f74223e1 (diff)
downloadandroid-node-v8-468ab4519e1b92473acefb22801497a1af6aebae.tar.gz
android-node-v8-468ab4519e1b92473acefb22801497a1af6aebae.tar.bz2
android-node-v8-468ab4519e1b92473acefb22801497a1af6aebae.zip
deps: upgrade npm to 6.1.0
PR-URL: https://github.com/nodejs/node/pull/20190 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Diffstat (limited to 'deps/npm/node_modules/yargs/index.js')
-rw-r--r--deps/npm/node_modules/yargs/index.js32
1 files changed, 32 insertions, 0 deletions
diff --git a/deps/npm/node_modules/yargs/index.js b/deps/npm/node_modules/yargs/index.js
new file mode 100644
index 0000000000..dfed54bc51
--- /dev/null
+++ b/deps/npm/node_modules/yargs/index.js
@@ -0,0 +1,32 @@
+'use strict'
+// classic singleton yargs API, to use yargs
+// without running as a singleton do:
+// require('yargs/yargs')(process.argv.slice(2))
+const yargs = require('./yargs')
+
+Argv(process.argv.slice(2))
+
+module.exports = Argv
+
+function Argv (processArgs, cwd) {
+ const argv = yargs(processArgs, cwd, require)
+ singletonify(argv)
+ return argv
+}
+
+/* Hack an instance of Argv with process.argv into Argv
+ so people can do
+ require('yargs')(['--beeble=1','-z','zizzle']).argv
+ to parse a list of args and
+ require('yargs').argv
+ to get a parsed version of process.argv.
+*/
+function singletonify (inst) {
+ Object.keys(inst).forEach((key) => {
+ if (key === 'argv') {
+ Argv.__defineGetter__(key, inst.__lookupGetter__(key))
+ } else {
+ Argv[key] = typeof inst[key] === 'function' ? inst[key].bind(inst) : inst[key]
+ }
+ })
+}