quiet options
This commit is contained in:
parent
8d66118b19
commit
8331190486
|
@ -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) {
|
||||||
process.stdout.write(chalk.redBright(response.message));
|
if (process.env.BW_QUIET !== 'true') {
|
||||||
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue