()
| 465 | */ |
| 466 | // eslint-disable-next-line @typescript-eslint/no-explicit-any |
| 467 | runner(): (...a: any[]) => Promise<any> { |
| 468 | // eslint-disable-next-line @typescript-eslint/no-explicit-any |
| 469 | return async (...args: any[]) => { |
| 470 | // Make sure the last argument is an object for options, add {} if none |
| 471 | if (typeof last(args) !== "object" || last(args) === null) { |
| 472 | args.push({}); |
| 473 | } |
| 474 | |
| 475 | // Args should have one entry for each positional arg (even the optional |
| 476 | // ones) and end with options. |
| 477 | while (args.length < this.positionalArgs.length + 1) { |
| 478 | // Add "" for missing args while keeping options at the end |
| 479 | args.splice(args.length - 1, 0, ""); |
| 480 | } |
| 481 | |
| 482 | const options = last(args); |
| 483 | await this.prepare(options); |
| 484 | |
| 485 | for (const before of this.befores) { |
| 486 | await before.fn(options, ...before.args); |
| 487 | } |
| 488 | return this.actionFn(...args); |
| 489 | }; |
| 490 | } |
| 491 | } |
| 492 | |
| 493 | // Project IDs must follow a certain format, as documented at: |
no test coverage detected