mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-11 06:30:03 +00:00
fix(cli): restore tts --text-file compatibility (#2117)
This commit is contained in:
@@ -46,6 +46,10 @@ export default defineCommand({
|
||||
description: "Text to speak, or path to a .txt file",
|
||||
required: false,
|
||||
},
|
||||
"text-file": {
|
||||
type: "string",
|
||||
description: "Read text from a .txt file (compatibility alias)",
|
||||
},
|
||||
output: {
|
||||
type: "string",
|
||||
description: "Output file path (default: speech.wav in current directory)",
|
||||
@@ -85,13 +89,14 @@ export default defineCommand({
|
||||
}
|
||||
|
||||
// ── Resolve input text ────────────────────────────────────────────
|
||||
if (!args.input) {
|
||||
const input = args["text-file"] ?? args.input;
|
||||
if (!input) {
|
||||
console.error(c.error("Provide text to speak, or use --list to see available voices."));
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
let text: string;
|
||||
const maybeFile = resolve(args.input);
|
||||
const maybeFile = resolve(input);
|
||||
|
||||
if (existsSync(maybeFile) && extname(maybeFile).toLowerCase() === ".txt") {
|
||||
text = readFileSync(maybeFile, "utf-8").trim();
|
||||
@@ -100,7 +105,7 @@ export default defineCommand({
|
||||
process.exit(1);
|
||||
}
|
||||
} else {
|
||||
text = args.input;
|
||||
text = input;
|
||||
}
|
||||
|
||||
if (!text.trim()) {
|
||||
|
||||
Reference in New Issue
Block a user