1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-15 15:53:27 +00:00

Apply Prettier (#426)

This commit is contained in:
Oscar Hinton
2021-12-20 18:04:00 +01:00
committed by GitHub
parent ec53a16c00
commit 910b4a24e6
59 changed files with 4630 additions and 4117 deletions

View File

@@ -1,31 +1,31 @@
import * as program from 'commander';
import * as program from "commander";
import { SyncService } from 'jslib-common/abstractions/sync.service';
import { SyncService } from "jslib-common/abstractions/sync.service";
import { Response } from 'jslib-node/cli/models/response';
import { MessageResponse } from 'jslib-node/cli/models/response/messageResponse';
import { StringResponse } from 'jslib-node/cli/models/response/stringResponse';
import { Response } from "jslib-node/cli/models/response";
import { MessageResponse } from "jslib-node/cli/models/response/messageResponse";
import { StringResponse } from "jslib-node/cli/models/response/stringResponse";
export class SyncCommand {
constructor(private syncService: SyncService) { }
constructor(private syncService: SyncService) {}
async run(options: program.OptionValues): Promise<Response> {
if (options.last || false) {
return await this.getLastSync();
}
try {
const result = await this.syncService.fullSync(options.force || false, true);
const res = new MessageResponse('Syncing complete.', null);
return Response.success(res);
} catch (e) {
return Response.error('Syncing failed: ' + e.toString());
}
async run(options: program.OptionValues): Promise<Response> {
if (options.last || false) {
return await this.getLastSync();
}
private async getLastSync() {
const lastSyncDate = await this.syncService.getLastSync();
const res = new StringResponse(lastSyncDate == null ? null : lastSyncDate.toISOString());
return Response.success(res);
try {
const result = await this.syncService.fullSync(options.force || false, true);
const res = new MessageResponse("Syncing complete.", null);
return Response.success(res);
} catch (e) {
return Response.error("Syncing failed: " + e.toString());
}
}
private async getLastSync() {
const lastSyncDate = await this.syncService.getLastSync();
const res = new StringResponse(lastSyncDate == null ? null : lastSyncDate.toISOString());
return Response.success(res);
}
}