(config: Config, flags: GlobalFlags)
| 36 | 'mmx speech voices --output json', |
| 37 | ], |
| 38 | async run(config: Config, flags: GlobalFlags) { |
| 39 | const format = detectOutputFormat(config.output); |
| 40 | |
| 41 | if (config.dryRun) { |
| 42 | console.log(formatOutput({ request: { voice_type: 'system' } }, format)); |
| 43 | return; |
| 44 | } |
| 45 | |
| 46 | const response = await requestJson<VoiceListResponse>(config, { |
| 47 | url: voicesEndpoint(config.baseUrl), |
| 48 | method: 'POST', |
| 49 | body: { voice_type: 'system' }, |
| 50 | }); |
| 51 | |
| 52 | const voices = response.system_voice ?? []; |
| 53 | const language = flags.language as string | undefined; |
| 54 | |
| 55 | if (language) { |
| 56 | const filtered = filterByLanguage(voices, language); |
| 57 | |
| 58 | if (format !== 'text') { |
| 59 | console.log(formatOutput(filtered, format)); |
| 60 | return; |
| 61 | } |
| 62 | |
| 63 | for (const v of filtered) { |
| 64 | const desc = v.description?.join('; ') || ''; |
| 65 | const name = v.voice_name ? ` (${v.voice_name})` : ''; |
| 66 | console.log(` ${v.voice_id}${name}`); |
| 67 | if (desc) console.log(` ${desc}`); |
| 68 | } |
| 69 | } else { |
| 70 | if (format !== 'text') { |
| 71 | console.log(formatOutput(voices.map(v => v.voice_id), format)); |
| 72 | return; |
| 73 | } |
| 74 | |
| 75 | for (const v of voices) { |
| 76 | console.log(v.voice_id); |
| 77 | } |
| 78 | } |
| 79 | }, |
| 80 | }); |
nothing calls this directly
no test coverage detected