Remove duplicated whoami command

This commit is contained in:
Juan Cruz Viotti 2015-04-20 12:46:43 -04:00
parent ae8c941bfe
commit 8041905144
2 changed files with 7 additions and 34 deletions

View File

@ -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();
});
}
};

View File

@ -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()