MCPcopy
hub / github.com/Effect-TS/effect / parseChildrenWith

Function parseChildrenWith

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

Source from the content-addressed store, hash-verified

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

Callers 1

parseInternalFunction · 0.85

Calls 2

loopFunction · 0.70
nextMethod · 0.65

Tested by

no test coverage detected