diff options
Diffstat (limited to 'deps/npm/lib/adduser.js')
-rw-r--r-- | deps/npm/lib/adduser.js | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/deps/npm/lib/adduser.js b/deps/npm/lib/adduser.js index 3a7425d471b..e04af0556b8 100644 --- a/deps/npm/lib/adduser.js +++ b/deps/npm/lib/adduser.js @@ -4,7 +4,9 @@ var log = require('npmlog') var npm = require('./npm.js') var read = require('read') var userValidate = require('npm-user-validate') +var output = require('./utils/output') var usage = require('./utils/usage') +var chain = require('slide').chain var crypto try { @@ -30,15 +32,14 @@ function adduser (args, cb) { e: creds.email || '' } var u = {} - var fns = [readUsername, readPassword, readEmail, save] - loop() - function loop (er) { - if (er) return cb(er) - var fn = fns.shift() - if (fn) return fn(c, u, loop) - cb() - } + log.disableProgress() + chain([ + [readUsername, c, u], + [readPassword, c, u], + [readEmail, c, u], + [save, c, u] + ], cb) } function readUsername (c, u, cb) { @@ -173,7 +174,7 @@ function save (c, u, cb) { log.info('adduser', 'Authorized user %s', u.u) var scopeMessage = scope ? ' to scope ' + scope : '' - console.log('Logged in as %s%s on %s.', u.u, scopeMessage, uri) + output('Logged in as %s%s on %s.', u.u, scopeMessage, uri) npm.config.save('user', cb) }) } |