MCPcopy Create free account
hub / github.com/Effect-TS/effect / loop

Function loop

packages/cli/src/internal/commandDescriptor.ts:453–473  ·  view source on GitHub ↗
(
    self: Instruction,
    isSubcommand: boolean
  )

Source from the content-addressed store, hash-verified

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

Callers 4

getSubcommandsInternalFunction · 0.70
parseChildrenWithFunction · 0.70
wizardInternalFunction · 0.70
traverseCommandFunction · 0.70

Calls 15

isStandardFunction · 0.85
getSubcommandsInternalFunction · 0.85
getNamesInternalFunction · 0.85
parseInternalFunction · 0.70
pipeFunction · 0.70
makeChoiceFunction · 0.70
ofMethod · 0.65
pipeMethod · 0.65
nextMethod · 0.65
failMethod · 0.65
getMethod · 0.65
joinMethod · 0.65

Tested by

no test coverage detected