diff --git a/build/actions/auth.js b/build/actions/auth.js index 328f6500..e0fbee51 100644 --- a/build/actions/auth.js +++ b/build/actions/auth.js @@ -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', diff --git a/lib/actions/auth.coffee b/lib/actions/auth.coffee index d0ce92f8..c6161002 100644 --- a/lib/actions/auth.coffee +++ b/lib/actions/auth.coffee @@ -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' diff --git a/package.json b/package.json index 5ea7506c..526a8ba8 100644 --- a/package.json +++ b/package.json @@ -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",