From 22062cc9f6f5df650f7bc3ffd8dde00ea8a882ef Mon Sep 17 00:00:00 2001 From: Estelle Poulin Date: Tue, 15 Jan 2019 11:46:58 -0500 Subject: [PATCH] add login check option (#47) --- src/program.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/program.ts b/src/program.ts index b284f3a1eb..20df039aae 100644 --- a/src/program.ts +++ b/src/program.ts @@ -92,6 +92,14 @@ export class Program { .description('Log into a user account.') .option('--method ', 'Two-step login method.') .option('--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', () => { writeLn('\n Notes:'); writeLn('');