mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-02-20 17:33:18 +00:00
Remove duplicated whoami command
This commit is contained in:
parent
ae8c941bfe
commit
8041905144
@ -15,22 +15,6 @@
|
||||
|
||||
visuals = require('resin-cli-visuals');
|
||||
|
||||
exports.whoami = {
|
||||
signature: 'whoami',
|
||||
description: 'whoami',
|
||||
help: 'Use this command to get the logged in user name.\n\nExamples:\n\n $ resin whoami',
|
||||
permission: 'user',
|
||||
action: function(params, options, done) {
|
||||
return resin.auth.whoami(function(error, username) {
|
||||
if (error != null) {
|
||||
return done(error);
|
||||
}
|
||||
console.log(username);
|
||||
return done();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
TOKEN_URL = url.resolve(settings.get('remoteUrl'), '/preferences');
|
||||
|
||||
exports.login = {
|
||||
@ -129,10 +113,14 @@
|
||||
permission: 'user',
|
||||
action: function(params, options, done) {
|
||||
return resin.auth.whoami(function(error, username) {
|
||||
if (error != null) {
|
||||
return done(error);
|
||||
}
|
||||
if (username == null) {
|
||||
return done(new Error('Username not found'));
|
||||
}
|
||||
return console.log(username);
|
||||
console.log(username);
|
||||
return done();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
@ -6,23 +6,6 @@ resin = require('resin-sdk')
|
||||
settings = require('resin-settings-client')
|
||||
visuals = require('resin-cli-visuals')
|
||||
|
||||
exports.whoami =
|
||||
signature: 'whoami'
|
||||
description: 'whoami'
|
||||
help: '''
|
||||
Use this command to get the logged in user name.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin whoami
|
||||
'''
|
||||
permission: 'user'
|
||||
action: (params, options, done) ->
|
||||
resin.auth.whoami (error, username) ->
|
||||
return done(error) if error?
|
||||
console.log(username)
|
||||
return done()
|
||||
|
||||
TOKEN_URL = url.resolve(settings.get('remoteUrl'), '/preferences')
|
||||
|
||||
exports.login =
|
||||
@ -166,8 +149,10 @@ exports.whoami =
|
||||
permission: 'user'
|
||||
action: (params, options, done) ->
|
||||
resin.auth.whoami (error, username) ->
|
||||
return done(error) if error?
|
||||
|
||||
if not username?
|
||||
return done(new Error('Username not found'))
|
||||
|
||||
console.log(username)
|
||||
return done()
|
||||
|
Loading…
x
Reference in New Issue
Block a user