MCPcopy Index your code
hub / github.com/cloudconvert/cloudconvert-cli / createFileJobCommand

Function createFileJobCommand

src/commands/file-job.ts:22–41  ·  view source on GitHub ↗
(
  definition: FileJobCommandDefinition,
  runJob: JobRunner
)

Source from the content-addressed store, hash-verified

20}
21
22export function createFileJobCommand(
23 definition: FileJobCommandDefinition,
24 runJob: JobRunner
25): CommandModule<object, object> {
26 return {
27 command: definition.command,
28 describe: definition.describe,
29 builder: yargs => buildFileJobOptions(yargs, definition),
30 handler: async rawArgv => {
31 const argv = rawArgv as unknown as CliArguments;
32 const minFiles = definition.minFiles ?? 1;
33
34 if ((argv.files ?? []).length < minFiles) {
35 throw new Error(`You need to provide at least ${minFiles === 1 ? 'one file' : 'two files'}!`);
36 }
37
38 await runJob(argv, createTaskData(definition, argv));
39 }
40 };
41}
42
43function buildFileJobOptions(argv: Argv<object>, definition: FileJobCommandDefinition): Argv<object> {
44 let builder = argv.positional('files', {

Callers 6

createMergeCommandFunction · 0.85
createPdfCommandsFunction · 0.85
createWatermarkCommandFunction · 0.85
createOptimizeCommandFunction · 0.85
createThumbnailCommandFunction · 0.85
createConvertCommandFunction · 0.85

Calls 3

buildFileJobOptionsFunction · 0.85
runJobFunction · 0.85
createTaskDataFunction · 0.85

Tested by

no test coverage detected