Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/config.js')
-rw-r--r--lib/config.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/config.js b/lib/config.js
index c528697bc..8e47e017f 100644
--- a/lib/config.js
+++ b/lib/config.js
@@ -7,6 +7,20 @@ config.usage = "npm config set <key> <value>"
+ "\nnpm config list"
+ "\nnpm config edit"
+config.completion = function(args, index, cb) {
+ var getCompletions = require("./utils/completion/get-completions")
+ , subcmdList = ["set", "get", "ls", "delete", "edit"]
+ , takeKeys = ["set", "get", "delete"]
+ , subcmd = args[0] || ""
+ , key = args[1] || ""
+
+ if (subcmdList.indexOf(subcmd) !== -1) {
+ if (takeKeys.indexOf(subcmd) !== -1 && ini.keys.indexOf(key) === -1) {
+ cb(null, getCompletions(key, ini.keys))
+ }
+ } else cb(null, getCompletions(subcmd, subcmdList))
+}
+
var ini = require("./utils/ini")
, log = require("./utils/log")
, npm = require("../npm")