(runJob: JobRunner)
| 12 | } |
| 13 | |
| 14 | export function createCommandCommand(runJob: JobRunner): CommandModule<object, object> { |
| 15 | return { |
| 16 | command: 'command <files..>', |
| 17 | describe: 'Execute custom ffmpeg, imagemagick, or graphicsmagick commands', |
| 18 | builder: yargs => buildCommandOptions(yargs), |
| 19 | handler: async rawArgv => { |
| 20 | const argv = rawArgv as unknown as CommandOperationArguments; |
| 21 | |
| 22 | if ((argv.files ?? []).length < 1) { |
| 23 | throw new Error('You need to provide at least one file!'); |
| 24 | } |
| 25 | |
| 26 | await runJob(argv, { |
| 27 | operation: 'command', |
| 28 | engine: argv.engine, |
| 29 | command: argv.command, |
| 30 | arguments: argv.arguments, |
| 31 | capture_output: argv.captureOutput, |
| 32 | ...collectTaskParameters(argv) |
| 33 | }); |
| 34 | } |
| 35 | }; |
| 36 | } |
| 37 | |
| 38 | function buildCommandOptions(argv: Argv<object>): Argv<object> { |
| 39 | return addTaskParameterMiddleware( |
no test coverage detected