feat: wrap TTS output text to terminal width

This commit is contained in:
mitchell 2026-05-04 00:05:37 -04:00
parent b9610663a6
commit ea5b3728a5

6
tts.ts
View file

@ -69,12 +69,14 @@ for await (const line of koko.stdout) {
first = false;
const stop = Date.now();
const duration = ((stop - start) / 1000).toFixed(2);
console.log(chalk.blue(`\nTime-to-audio: ${duration}s`));
console.log(chalk.green(`\nTime-to-audio: ${duration}s`));
}
for (const info of infos) {
const [columns] = process.stdout.getWindowSize();
const text = Bun.wrapAnsi(info.text, columns);
const file = `${home}/.ttsc/${info.file}.wav`;
console.log(`\n${chalk.blue(file)}:\n${info.text}\n`);
console.log(`\n${chalk.blue(file)}:\n${text}\n`);
if (!wait) {
await Bun.spawn({