()
| 121 | } |
| 122 | |
| 123 | async function main() { |
| 124 | require(`yargs`) // eslint-disable-line |
| 125 | .demand(1) |
| 126 | .command('text <text>', 'Synthesizes audio file from text', {}, opts => |
| 127 | synthesizeText(opts.text, opts.outputFile) |
| 128 | ) |
| 129 | .command('ssml <ssml>', 'Synthesizes audio file from SSML', {}, opts => |
| 130 | synthesizeSsml(opts.ssml, opts.outputFile) |
| 131 | ) |
| 132 | .command( |
| 133 | 'text-file <textFile>', |
| 134 | 'Synthesizes audio file from text in a file', |
| 135 | {}, |
| 136 | opts => synthesizeTextFile(opts.textFile, opts.outputFile) |
| 137 | ) |
| 138 | .command( |
| 139 | 'ssml-file <ssmlFile>', |
| 140 | 'Synthesizes audio file from SSML in a file', |
| 141 | {}, |
| 142 | opts => synthesizeSsmlFile(opts.ssmlFile, opts.outputFile) |
| 143 | ) |
| 144 | .options({ |
| 145 | outputFile: { |
| 146 | alias: 'o', |
| 147 | default: 'output.mp3', |
| 148 | global: true, |
| 149 | requiresArg: true, |
| 150 | type: 'string', |
| 151 | }, |
| 152 | }) |
| 153 | .example('node $0 text "hello" -o hello.mp3') |
| 154 | .example('node $0 ssml "<speak>Hello there.</speak>" -o hello.mp3') |
| 155 | .example('node $0 text-file resources/hello.txt -o output.mp3') |
| 156 | .example('node $0 ssml-file resources/hello.ssml -o output.mp3') |
| 157 | .wrap(120) |
| 158 | .recommendCommands() |
| 159 | .epilogue( |
| 160 | 'For more information, see https://cloud.google.com/text-to-speech/docs' |
| 161 | ) |
| 162 | .help() |
| 163 | .strict().argv; |
| 164 | } |
| 165 | |
| 166 | main().catch(console.error); |
no test coverage detected