Permalink
Browse files

log config usage if undefined key in set function

  • Loading branch information...
1 parent dd1d780 commit 7a059d675e8a919d023c11a9a9d23fdd920db07c @gradus gradus committed with isaacs Mar 14, 2012
Showing with 7 additions and 1 deletion.
  1. +6 −1 lib/config.js
  2. +1 −0 lib/set.js
View
@@ -2,10 +2,12 @@
module.exports = config
config.usage = "npm config set <key> <value>"
- + "\nnpm config get <key>"
+ + "\nnpm config get [<key>]"
+ "\nnpm config delete <key>"
+ "\nnpm config list"
+ "\nnpm config edit"
+ + "\nnpm set <key> <value>"
+ + "\nnpm get [<key>]"
var ini = require("./utils/ini.js")
, log = require("./utils/log.js")
@@ -113,6 +115,9 @@ function del (key, cb) {
}
function set (key, val, cb) {
+ if (key === undefined) {
+ return unknown("", cb)
+ }
if (val === undefined) {
if (key.indexOf("=") !== -1) {
var k = key.split("=")
View
@@ -8,5 +8,6 @@ var npm = require("./npm.js")
set.completion = npm.commands.config.completion
function set (args, cb) {
+ if (!args.length) return cb(set.usage)
npm.commands.config(["set"].concat(args), cb)
}

0 comments on commit 7a059d6

Please sign in to comment.