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

Function parseChildrenWith

packages/cli/src/internal/commandDescriptor.ts:677–695  ·  view source on GitHub ↗
(argsForChildren: ReadonlyArray<string>)

Source from the content-addressed store, hash-verified

675 (arg) => !Arr.some(subcommands, ([name]) => name === arg)
676 )
677 const parseChildrenWith = (argsForChildren: ReadonlyArray<string>) =>
678 Effect.suspend(() => {
679 const iterator = self.children[Symbol.iterator]()
680 const loop = (
681 next: Instruction
682 ): Effect.Effect<
683 Directive.CommandDirective<any>,
684 ValidationError.ValidationError,
685 FileSystem.FileSystem | Path.Path | Terminal.Terminal
686 > => {
687 return parseInternal(next, argsForChildren, config).pipe(
688 Effect.catchIf(InternalValidationError.isCommandMismatch, (e) => {
689 const next = iterator.next()
690 return next.done ? Effect.fail(e) : loop(next.value)
691 })
692 )
693 }
694 return loop(iterator.next().value!)
695 })
696 const parseChildren = parseChildrenWith(childArgs)
697 const helpDirectiveForParent = Effect.sync(() => {
698 return InternalCommandDirective.builtIn(InternalBuiltInOptions.showHelp(

Callers 1

parseInternalFunction · 0.85

Calls 2

loopFunction · 0.70
nextMethod · 0.65

Tested by

no test coverage detected