diff --git a/lib/completion.js b/lib/completion.js
index 02b9caca07927..5e424684cb6e4 100644
--- a/lib/completion.js
+++ b/lib/completion.js
@@ -92,6 +92,10 @@ function completion (args, cb) {
   var cmd = parsed.argv.remain[1]
   if (!cmd) return cmdCompl(opts, cb)
 
+  Object.keys(parsed).forEach(function (k) {
+    npm.config.set(k, parsed[k])
+  })
+
   // at this point, if words[1] is some kind of npm command,
   // then complete on it.
   // otherwise, do nothing
@@ -131,16 +135,17 @@ function escape (w) {
 // to: "a", "b c", or "d" "e"
 function wrapCb (cb, opts) { return function (er, compls) {
   if (!Array.isArray(compls)) compls = compls ? [compls] : []
+  compls = compls.map(function (c) {
+    if (Array.isArray(c)) c = c.map(escape).join(" ")
+    else c = escape(c)
+    return c
+  })
   if (opts.partialWord) compls = compls.filter(function (c) {
     return c.indexOf(opts.partialWord) === 0
   })
   console.error([er && er.stack, compls, opts.partialWord])
   if (er || compls.length === 0) return cb(er)
-  output.write(compls.map(function (c) {
-    if (Array.isArray(c)) c = c.map(escape).join(" ")
-    else c = escape(c)
-    return c
-  }).join("\n"), stdio.stdoutFD, false, cb)
+  output.write(compls.join("\n"), stdio.stdoutFD, false, cb)
 }}
 
 // the current word has a dash.  Return the config names,