Merge pull request #2 from resin-io/feature/whoami

Reimplement whoami command
This commit is contained in:
Juan Cruz Viotti 2015-03-20 08:55:26 -04:00
commit fa5a7abbbf
3 changed files with 34 additions and 1 deletions

View File

@ -11,6 +11,22 @@
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();
});
}
};
exports.login = {
signature: 'login',
description: 'login to resin.io',

View File

@ -4,6 +4,23 @@ async = require('async')
resin = require('resin-sdk')
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()
exports.login =
signature: 'login'
description: 'login to resin.io'

View File

@ -62,7 +62,7 @@
"open": "0.0.5",
"progress-stream": "^0.5.0",
"resin-cli-visuals": "^0.1.0",
"resin-sdk": "^1.0.0",
"resin-sdk": "^1.1.0",
"resin-settings-client": "^1.0.0",
"resin-vcs": "^1.0.0",
"underscore.string": "~2.4.0",