add login check option (#47)
This commit is contained in:
parent
80bb03de91
commit
22062cc9f6
|
@ -92,6 +92,14 @@ export class Program {
|
||||||
.description('Log into a user account.')
|
.description('Log into a user account.')
|
||||||
.option('--method <method>', 'Two-step login method.')
|
.option('--method <method>', 'Two-step login method.')
|
||||||
.option('--code <code>', 'Two-step login code.')
|
.option('--code <code>', 'Two-step login code.')
|
||||||
|
.option('--check', 'Check login status.', async () => {
|
||||||
|
const authed = await this.main.userService.isAuthenticated();
|
||||||
|
if (authed) {
|
||||||
|
const res = new StringResponse('You are logged in!');
|
||||||
|
this.processResponse(Response.success(res), true);
|
||||||
|
}
|
||||||
|
this.processResponse(Response.error('You are not logged in.'), true);
|
||||||
|
})
|
||||||
.on('--help', () => {
|
.on('--help', () => {
|
||||||
writeLn('\n Notes:');
|
writeLn('\n Notes:');
|
||||||
writeLn('');
|
writeLn('');
|
||||||
|
|
Loading…
Reference in New Issue