core: 支持系统级语言设置

This commit is contained in:
undefined committed 2021-01-09 22:44:38 +08:00
1 parent 5a7114ed8c
commit 1aeaf14a03
4 files changed
+10 -5

No files matched your search

+6 -3
View File
@@ -13,6 +13,8 @@ declare module 'terminal-kit/Terminal' {
}
}
const useTerminal = cluster.isMaster && process.stdout.isTTY && !argv.legacy;
export namespace Progress {
export class Progress {
constructor(public args) {
@@ -31,7 +33,8 @@ export namespace Progress {
}
export function create(args) {
return (process.stdout.isTTY && !argv.legacy)
// TODO handle worker process
return useTerminal
? terminal.progressBar(args)
: new Progress(args);
}
@@ -44,7 +47,7 @@ async function terminate() {
} catch (e) {
hasError = true;
}
if (cluster.isMaster && process.stdout.isTTY && !argv.legacy) {
if (useTerminal) {
terminal.hideCursor(false);
terminal.styleReset();
terminal.resetScrollingRegion();
@@ -55,7 +58,7 @@ async function terminate() {
}
process.on('SIGINT', terminate);
if (cluster.isMaster && process.stdout.isTTY && !argv.legacy) {
if (useTerminal) {
terminal.clear();
terminal.grabInput();
terminal.hideCursor();