(...args: Array<unknown>)
| 621 | ...expressions: ReadonlyArray<TemplateExpression> |
| 622 | ): StandardCommand |
| 623 | } = function make(...args: Array<unknown>): any { |
| 624 | // Template literal form: make`command` |
| 625 | if (isTemplateString(args[0])) { |
| 626 | const [templates, ...expressions] = args as [TemplateStringsArray, ...ReadonlyArray<TemplateExpression>] |
| 627 | const tokens = parseTemplates(templates, expressions) |
| 628 | return makeStandardCommand(tokens[0] ?? "", tokens.slice(1), {}) |
| 629 | } |
| 630 | |
| 631 | // Options form: make({ cwd: "/tmp" })`command` |
| 632 | if (typeof args[0] === "object" && !Array.isArray(args[0]) && !isTemplateString(args[0])) { |
| 633 | const options = args[0] as CommandOptions |
| 634 | return function( |
| 635 | templates: TemplateStringsArray, |
| 636 | ...expressions: ReadonlyArray<TemplateExpression> |
| 637 | ): StandardCommand { |
| 638 | const tokens = parseTemplates(templates, expressions) |
| 639 | return makeStandardCommand(tokens[0] ?? "", tokens.slice(1), options) |
| 640 | } |
| 641 | } |
| 642 | |
| 643 | // Standard form without arguments: make("command", options?) |
| 644 | if (typeof args[0] === "string" && !Array.isArray(args[1])) { |
| 645 | const [command, options = {}] = args as [string, CommandOptions?] |
| 646 | return makeStandardCommand(command, [], options) |
| 647 | } |
| 648 | |
| 649 | // Standard form with arguments: make("command", ["arg1", "arg2"], options?) |
| 650 | const [command, cmdArgs = [], options = {}] = args as [ |
| 651 | string, |
| 652 | ReadonlyArray<string>?, |
| 653 | CommandOptions? |
| 654 | ] |
| 655 | return makeStandardCommand(command, cmdArgs, options) |
| 656 | } |
| 657 | |
| 658 | /** |
| 659 | * Pipes the output of one command to the input of another. |
nothing calls this directly
no test coverage detected