mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-06-04 00:40:41 +00:00
Reimplement whoami command
This commit is contained in:
parent
3c0378142a
commit
cd8bb7882e
@ -11,6 +11,22 @@
|
|||||||
|
|
||||||
visuals = require('resin-cli-visuals');
|
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 = {
|
exports.login = {
|
||||||
signature: 'login',
|
signature: 'login',
|
||||||
description: 'login to resin.io',
|
description: 'login to resin.io',
|
||||||
|
@ -4,6 +4,23 @@ async = require('async')
|
|||||||
resin = require('resin-sdk')
|
resin = require('resin-sdk')
|
||||||
visuals = require('resin-cli-visuals')
|
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 =
|
exports.login =
|
||||||
signature: 'login'
|
signature: 'login'
|
||||||
description: 'login to resin.io'
|
description: 'login to resin.io'
|
||||||
|
@ -62,7 +62,7 @@
|
|||||||
"open": "0.0.5",
|
"open": "0.0.5",
|
||||||
"progress-stream": "^0.5.0",
|
"progress-stream": "^0.5.0",
|
||||||
"resin-cli-visuals": "^0.1.0",
|
"resin-cli-visuals": "^0.1.0",
|
||||||
"resin-sdk": "^1.0.0",
|
"resin-sdk": "^1.1.0",
|
||||||
"resin-settings-client": "^1.0.0",
|
"resin-settings-client": "^1.0.0",
|
||||||
"resin-vcs": "^1.0.0",
|
"resin-vcs": "^1.0.0",
|
||||||
"underscore.string": "~2.4.0",
|
"underscore.string": "~2.4.0",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user