MCPcopy Index your code
hub / github.com/Effect-TS/effect / parseUserDefinedArgs

Function parseUserDefinedArgs

packages/cli/src/internal/commandDescriptor.ts:569–601  ·  view source on GitHub ↗
(
        args: ReadonlyArray<string>
      )

Source from the content-addressed store, hash-verified

567 }
568 })
569 const parseUserDefinedArgs = (
570 args: ReadonlyArray<string>
571 ): Effect.Effect<
572 Directive.CommandDirective<unknown>,
573 ValidationError.ValidationError,
574 FileSystem.FileSystem | Path.Path | Terminal.Terminal
575 > =>
576 parseCommandLine(self, args).pipe(Effect.flatMap((commandOptionsAndArgs) => {
577 const [optionsAndArgs, forcedCommandArgs] = splitForcedArgs(commandOptionsAndArgs)
578 return InternalOptions.processCommandLine(self.options, optionsAndArgs, config).pipe(
579 Effect.flatMap(([error, commandArgs, optionsType]) =>
580 InternalArgs.validate(
581 self.args,
582 Arr.appendAll(commandArgs, forcedCommandArgs),
583 config
584 ).pipe(
585 Effect.catchAll((e) =>
586 Option.match(error, {
587 onNone: () => Effect.fail(e),
588 onSome: (err) => Effect.fail(err)
589 })
590 ),
591 Effect.map(([argsLeftover, argsType]) =>
592 InternalCommandDirective.userDefined(argsLeftover, {
593 name: self.name,
594 options: optionsType,
595 args: argsType
596 })
597 )
598 )
599 )
600 )
601 }))
602 const exhaustiveSearch = (
603 args: ReadonlyArray<string>
604 ): Effect.Effect<

Callers 1

parseInternalFunction · 0.85

Calls 6

splitForcedArgsFunction · 0.85
validateMethod · 0.80
parseCommandLineFunction · 0.70
pipeMethod · 0.65
failMethod · 0.65
mapMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…