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

Function extractKeyValue

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

Source from the content-addressed store, hash-verified

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

Callers 1

parseInternalFunction · 0.85

Calls 2

splitMethod · 0.80
failMethod · 0.65

Tested by

no test coverage detected