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

Function extractKeyValue

packages/cli/src/internal/options.ts:1231–1240  ·  view source on GitHub ↗
(
        value: string
      )

Source from the content-addressed store, hash-verified

1229 }
1230 case "KeyValueMap": {
1231 const extractKeyValue = (
1232 value: string
1233 ): Effect.Effect<[string, string], ValidationError.ValidationError> => {
1234 const split = value.trim().split(keyValueSplitter, 2)
1235 if (Arr.isNonEmptyReadonlyArray(split) && split.length === 2 && split[1] !== "") {
1236 return Effect.succeed(split as unknown as [string, string])
1237 }
1238 const error = InternalHelpDoc.p(`Expected a key/value pair but received '${value}'`)
1239 return Effect.fail(InternalValidationError.invalidArgument(error))
1240 }
1241 return parseInternal(self.argumentOption, args, config).pipe(Effect.matchEffect({
1242 onFailure: (e) =>
1243 InternalValidationError.isMultipleValuesDetected(e)

Callers 1

parseInternalFunction · 0.85

Calls 2

splitMethod · 0.80
failMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…