( command: Command.Command.Any, commandPath: ReadonlyArray<string> )
| 31 | ) |
| 32 | |
| 33 | const getCommandAtPath = ( |
| 34 | command: Command.Command.Any, |
| 35 | commandPath: ReadonlyArray<string> |
| 36 | ): Command.Command.Any => { |
| 37 | let current = command |
| 38 | for (const name of commandPath.slice(1)) { |
| 39 | const child = current.subcommands |
| 40 | .flatMap((group) => group.commands) |
| 41 | .find((candidate) => candidate.name === name || candidate.alias === name) |
| 42 | if (child === undefined) { |
| 43 | break |
| 44 | } |
| 45 | current = child |
| 46 | } |
| 47 | return current |
| 48 | } |
| 49 | |
| 50 | const promptCommand: ( |
| 51 | command: Command.Command.Any, |