mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-01-18 02:39:49 +00:00
Add optional interactivity to login command
This commit is contained in:
parent
275eed82f0
commit
24f50fa5ec
@ -1,10 +1,22 @@
|
||||
open = require('open')
|
||||
async = require('async')
|
||||
auth = require('../auth/auth')
|
||||
widgets = require('../widgets/widgets')
|
||||
config = require('../config')
|
||||
|
||||
exports.login = (credentials) ->
|
||||
parsedCredentials = auth.parseCredentials(credentials)
|
||||
auth.login parsedCredentials, (error) ->
|
||||
async.waterfall [
|
||||
|
||||
(callback) ->
|
||||
if credentials?
|
||||
return auth.parseCredentials(credentials, callback)
|
||||
else
|
||||
return widgets.login(callback)
|
||||
|
||||
(credentials, callback) ->
|
||||
auth.login(credentials, callback)
|
||||
|
||||
], (error) ->
|
||||
throw error if error?
|
||||
|
||||
exports.logout = ->
|
||||
|
@ -10,7 +10,7 @@ program.version(packageJSON.version)
|
||||
auth = require('./actions/auth')
|
||||
|
||||
program
|
||||
.command('login <username:password>')
|
||||
.command('login [username:password]')
|
||||
.description('Login with your resin.io account')
|
||||
.action(auth.login)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user