Skip to content

Commit

Permalink
Add tty check on stdout.clearLine
Browse files Browse the repository at this point in the history
  • Loading branch information
huchenlei committed Dec 12, 2024
1 parent 09ce889 commit 365cd85
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/lobe-i18n/src/commands/TranslateLocale/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,10 @@ class TranslateLocale {

for (const locale of config.outputLocales) {
for (const [index, filename] of files.entries()) {
process.stdout.clearLine(0);
process.stdout.cursorTo(0);
if (process.stdout.isTTY) {
process.stdout.clearLine(0);
process.stdout.cursorTo(0);
}

process.stdout.write(
`${chalk.cyan(locale)}${chalk.gray(`[${index + 1}/${files.length}] - `)}${chalk.yellow(filename)}`,
Expand All @@ -118,8 +120,10 @@ class TranslateLocale {
}
}

process.stdout.clearLine(0);
process.stdout.cursorTo(0);
if (process.stdout.isTTY) {
process.stdout.clearLine(0);
process.stdout.cursorTo(0);
}
}

genFlatQuery() {
Expand Down

0 comments on commit 365cd85

Please sign in to comment.