(
self: Instruction,
isSubcommand: boolean
)
| 450 | self: Instruction |
| 451 | ): Array<[string, GetUserInput | Standard]> => { |
| 452 | const loop = ( |
| 453 | self: Instruction, |
| 454 | isSubcommand: boolean |
| 455 | ): Array<[string, GetUserInput | Standard]> => { |
| 456 | switch (self._tag) { |
| 457 | case "Standard": |
| 458 | case "GetUserInput": { |
| 459 | return Arr.of([self.name, self]) |
| 460 | } |
| 461 | case "Map": { |
| 462 | return loop(self.command, isSubcommand) |
| 463 | } |
| 464 | case "Subcommands": { |
| 465 | // Ensure that we only traverse the subcommands one level deep from the |
| 466 | // parent command |
| 467 | return isSubcommand |
| 468 | ? loop(self.parent, false) |
| 469 | : Arr.flatMap(self.children, (child) => loop(child, true)) |
| 470 | } |
| 471 | } |
| 472 | } |
| 473 | return loop(self, false) |
| 474 | } |
| 475 |
no test coverage detected
searching dependent graphs…