mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 08:13:42 +00:00
chalk and source maps
This commit is contained in:
@@ -12,8 +12,14 @@ export class CreateCommand {
|
||||
constructor(private cipherService: CipherService, private folderService: FolderService) { }
|
||||
|
||||
async run(object: string, requestData: string, cmd: program.Command): Promise<Response> {
|
||||
const reqJson = new Buffer(requestData, 'base64').toString();
|
||||
const req = JSON.parse(reqJson);
|
||||
let req: any = null;
|
||||
try {
|
||||
const reqJson = new Buffer(requestData, 'base64').toString();
|
||||
req = JSON.parse(reqJson);
|
||||
} catch (e) {
|
||||
return Response.badRequest('Error parsing the encoded request data.');
|
||||
}
|
||||
|
||||
switch (object.toLowerCase()) {
|
||||
case 'item':
|
||||
return await this.createCipher(req);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import * as chk from 'chalk';
|
||||
import * as program from 'commander';
|
||||
|
||||
import { Main } from './bw';
|
||||
@@ -16,6 +17,8 @@ import { TemplateResponse } from './models/response/templateResponse';
|
||||
|
||||
import { Response } from './models/response';
|
||||
|
||||
const chalk = chk.default;
|
||||
|
||||
export class Program {
|
||||
constructor(private main: Main) { }
|
||||
|
||||
@@ -124,7 +127,7 @@ export class Program {
|
||||
}
|
||||
process.exit();
|
||||
} else {
|
||||
process.stdout.write(response.message);
|
||||
process.stdout.write(chalk.redBright(response.message));
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user