mirror of
https://github.com/bitwarden/directory-connector
synced 2025-12-19 17:53:20 +00:00
write failed responses to stderr
This commit is contained in:
2
jslib
2
jslib
Submodule jslib updated: 802d38f52e...a1823f9931
@@ -20,11 +20,12 @@ import { Response } from 'jslib/cli/models/response';
|
|||||||
import { StringResponse } from 'jslib/cli/models/response/stringResponse';
|
import { StringResponse } from 'jslib/cli/models/response/stringResponse';
|
||||||
|
|
||||||
const chalk = chk.default;
|
const chalk = chk.default;
|
||||||
const writeLn = (s: string, finalLine: boolean = false) => {
|
const writeLn = (s: string, finalLine: boolean = false, error: boolean = false) => {
|
||||||
|
const stream = error ? process.stderr : process.stdout;
|
||||||
if (finalLine && process.platform === 'win32') {
|
if (finalLine && process.platform === 'win32') {
|
||||||
process.stdout.write(s);
|
stream.write(s);
|
||||||
} else {
|
} else {
|
||||||
process.stdout.write(s + '\n');
|
stream.write(s + '\n');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -58,8 +59,8 @@ export class Program extends BaseProgram {
|
|||||||
});
|
});
|
||||||
|
|
||||||
program.on('command:*', () => {
|
program.on('command:*', () => {
|
||||||
writeLn(chalk.redBright('Invalid command: ' + program.args.join(' ')));
|
writeLn(chalk.redBright('Invalid command: ' + program.args.join(' ')), false, true);
|
||||||
writeLn('See --help for a list of available commands.', true);
|
writeLn('See --help for a list of available commands.', true, true);
|
||||||
process.exitCode = 1;
|
process.exitCode = 1;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user