diff options
author | isaacs <i@izs.me> | 2012-07-24 12:34:13 -0700 |
---|---|---|
committer | isaacs <i@izs.me> | 2012-07-24 12:34:13 -0700 |
commit | 0a0002b480dc40ecd94c542d1101e87404a47692 (patch) | |
tree | 53148415db52f4f4ccf7dad1c0e0b4ccf504b64d /deps/npm/node_modules/node-gyp/lib/node-gyp.js | |
parent | 43a0c8811627ea224bb18ba3c72b91ca2c4ea8d7 (diff) | |
download | node-0a0002b480dc40ecd94c542d1101e87404a47692.tar.gz |
npm: Upgrade to 1.1.45
This includes node-gyp 0.6.1
Diffstat (limited to 'deps/npm/node_modules/node-gyp/lib/node-gyp.js')
-rw-r--r-- | deps/npm/node_modules/node-gyp/lib/node-gyp.js | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/deps/npm/node_modules/node-gyp/lib/node-gyp.js b/deps/npm/node_modules/node-gyp/lib/node-gyp.js index 9b2282520..6681daafe 100644 --- a/deps/npm/node_modules/node-gyp/lib/node-gyp.js +++ b/deps/npm/node_modules/node-gyp/lib/node-gyp.js @@ -112,15 +112,31 @@ proto.parseArgv = function parseOpts (argv) { this.opts = nopt(this.configDefs, this.shorthands, argv) this.argv = this.opts.argv.remain.slice() - var commands = [] - this.argv.slice().forEach(function (arg) { - if (arg in this.commands || arg in this.aliases) { - this.argv.splice(this.argv.indexOf(arg), 1) - commands.push(arg) + var commands = this.todo = [] + + // create a copy of the argv array with aliases mapped + var argv = this.argv.map(function (arg) { + // is this an alias? + if (arg in this.aliases) { + arg = this.aliases[arg] } + return arg }, this) - this.todo = commands + // process the mapped args into "command" objects ("name" and "args" props) + argv.slice().forEach(function (arg) { + if (arg in this.commands) { + var args = argv.splice(0, argv.indexOf(arg)) + argv.shift() + if (commands.length > 0) { + commands[commands.length - 1].args = args + } + commands.push({ name: arg, args: [] }) + } + }, this) + if (commands.length > 0) { + commands[commands.length - 1].args = argv.splice(0) + } // support for inheriting config env variables from npm var npm_config_prefix = 'npm_config_' |