Skip to content

Commit

Permalink
Support 'npm-g' as a global bin
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacs committed Jun 11, 2011
1 parent 7124cf3 commit 03bd669
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 6 additions & 0 deletions bin/npm.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ var fs = require("../lib/utils/graceful-fs")
, types = configDefs.types
, nopt = require("nopt")

// if npm is called as "npmg" or "npm_g", then
// run in global mode.
if(path.basename(process.argv[1]).slice(-1) === "g") {
process.argv.splice(1, 1, "npm", "-g")
}

log.verbose(process.argv, "cli")

var conf = nopt(types, shorthands)
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
, "bin" : "./bin"
}
, "main" : "npm"
, "bin" : "./bin/npm.js"
, "bin" : { "npm" : "./bin/npm.js"
, "npm_g" : "./bin/npm.js"
, "npm-g" : "./bin/npm.js" }
, "dependencies" :
{ "semver" : "1"
, "abbrev" : "1"
Expand Down

0 comments on commit 03bd669

Please sign in to comment.