mirror of
https://github.com/bitwarden/cli
synced 2025-12-23 03:33:13 +00:00
updates to status command and add hidePasswords (#146)
* a few updates to the recent status addition * add hidePasswords functionality
This commit is contained in:
@@ -1,15 +1,17 @@
|
||||
import * as program from 'commander';
|
||||
|
||||
import { EnvironmentService, SyncService, UserService, VaultTimeoutService } from 'jslib/abstractions';
|
||||
import { EnvironmentService } from 'jslib/abstractions/environment.service';
|
||||
import { SyncService } from 'jslib/abstractions/sync.service';
|
||||
import { UserService } from 'jslib/abstractions/user.service';
|
||||
import { VaultTimeoutService } from 'jslib/abstractions/vaultTimeout.service';
|
||||
|
||||
import { Response } from 'jslib/cli/models/response';
|
||||
|
||||
import { TemplateResponse } from '../models/response/templateResponse';
|
||||
|
||||
export class StatusCommand {
|
||||
constructor(
|
||||
private envService: EnvironmentService,
|
||||
private syncService: SyncService,
|
||||
private userService: UserService,
|
||||
private vaultTimeoutService: VaultTimeoutService) {
|
||||
constructor(private envService: EnvironmentService, private syncService: SyncService,
|
||||
private userService: UserService, private vaultTimeoutService: VaultTimeoutService) {
|
||||
}
|
||||
|
||||
async run(cmd: program.Command): Promise<Response> {
|
||||
@@ -41,16 +43,12 @@ export class StatusCommand {
|
||||
}
|
||||
|
||||
private async status(): Promise<string> {
|
||||
const isAuthed = await this.userService.isAuthenticated();
|
||||
if (!isAuthed) {
|
||||
const authed = await this.userService.isAuthenticated();
|
||||
if (!authed) {
|
||||
return 'unauthenticated';
|
||||
}
|
||||
|
||||
const isLocked = await this.vaultTimeoutService.isLocked();
|
||||
if (isLocked) {
|
||||
return 'locked';
|
||||
} else {
|
||||
return 'unlocked';
|
||||
}
|
||||
return isLocked ? 'locked' : 'unlocked';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user