1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-24 12:06:15 +01:00

quiet options

This commit is contained in:
Kyle Spearrin 2018-05-16 10:29:57 -04:00
parent 8d66118b19
commit 8331190486

View File

@ -31,6 +31,7 @@ export class Program {
.version(this.main.platformUtilsService.getApplicationVersion(), '-v, --version') .version(this.main.platformUtilsService.getApplicationVersion(), '-v, --version')
.option('--pretty', 'Format stdout.') .option('--pretty', 'Format stdout.')
.option('--raw', 'Raw output instead a descriptive message.') .option('--raw', 'Raw output instead a descriptive message.')
.option('--quiet', 'Do not write anything to stdout.')
.option('--session <session>', 'Session key.'); .option('--session <session>', 'Session key.');
program.on('option:pretty', () => { program.on('option:pretty', () => {
@ -41,6 +42,10 @@ export class Program {
process.env.BW_RAW = 'true'; process.env.BW_RAW = 'true';
}); });
program.on('option:quiet', () => {
process.env.BW_QUIET = 'true';
});
program.on('option:session', (key) => { program.on('option:session', (key) => {
process.env.BW_SESSION = key; process.env.BW_SESSION = key;
}); });
@ -180,7 +185,9 @@ export class Program {
private processResponse(response: Response) { private processResponse(response: Response) {
if (!response.success) { if (!response.success) {
if (process.env.BW_QUIET !== 'true') {
process.stdout.write(chalk.redBright(response.message)); process.stdout.write(chalk.redBright(response.message));
}
process.exit(1); process.exit(1);
return; return;
} }
@ -202,7 +209,7 @@ export class Program {
out = this.getJson(response.data); out = this.getJson(response.data);
} }
if (out != null) { if (out != null && process.env.BW_QUIET !== 'true') {
process.stdout.write(out); process.stdout.write(out);
} }
} }