mirror of
https://github.com/bitwarden/cli
synced 2025-12-16 08:13:21 +00:00
Add status command (#145)
* Show vault status. The status is shown as 'unauthenticated', 'locked', or 'unlocked'. * Add more status command fields. Added `serverUrl`, `lastSync`, `userEmail`, and `userId`. * Add status help text.
This commit is contained in:
committed by
GitHub
parent
c0c368cbfe
commit
62c7c30cb4
@@ -18,6 +18,7 @@ import { LockCommand } from './commands/lock.command';
|
||||
import { LoginCommand } from './commands/login.command';
|
||||
import { RestoreCommand } from './commands/restore.command';
|
||||
import { ShareCommand } from './commands/share.command';
|
||||
import { StatusCommand } from './commands/status.command';
|
||||
import { SyncCommand } from './commands/sync.command';
|
||||
import { UnlockCommand } from './commands/unlock.command';
|
||||
|
||||
@@ -682,6 +683,38 @@ export class Program extends BaseProgram {
|
||||
this.processResponse(response);
|
||||
});
|
||||
|
||||
program
|
||||
.command('status')
|
||||
.description('Show server, last sync, user information, and vault status.')
|
||||
.on('--help', () => {
|
||||
writeLn('');
|
||||
writeLn('');
|
||||
writeLn(' Example return value:');
|
||||
writeLn('');
|
||||
writeLn(' {');
|
||||
writeLn(' "serverUrl": "https://bitwarden.example.com",');
|
||||
writeLn(' "lastSync": "2020-06-16T06:33:51.419Z",');
|
||||
writeLn(' "userEmail": "user@example.com,');
|
||||
writeLn(' "userId": "00000000-0000-0000-0000-000000000000",');
|
||||
writeLn(' "status": "locked"');
|
||||
writeLn(' }');
|
||||
writeLn('');
|
||||
writeLn(' The "status" is one of "unauthenticated", "locked", "unlocked":');
|
||||
writeLn(' - "unauthenticated" when you are not logged in');
|
||||
writeLn(' - "locked" when you are logged in and the vault is locked');
|
||||
writeLn(' - "unlocked" when you are logged in and the vault is unlocked');
|
||||
writeLn('', true);
|
||||
})
|
||||
.action(async (cmd: program.Command) => {
|
||||
const command = new StatusCommand(
|
||||
this.main.environmentService,
|
||||
this.main.syncService,
|
||||
this.main.userService,
|
||||
this.main.vaultTimeoutService);
|
||||
const response = await command.run(cmd);
|
||||
this.processResponse(response);
|
||||
});
|
||||
|
||||
program
|
||||
.parse(process.argv);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user