MCPcopy Index your code
hub / github.com/anomalyco/opencode / optional

Function optional

packages/opencode/src/cli/effect/prompt.ts:14–17  ·  view source on GitHub ↗
(result: Value | symbol)

Source from the content-addressed store, hash-verified

12}
13
14const optional = <Value>(result: Value | symbol) => {
15 if (prompts.isCancel(result)) return Option.none<Value>()
16 return Option.some(result)
17}
18
19export const select = <Value>(opts: Parameters<typeof prompts.select<Value>>[0]) =>
20 Effect.promise(() => prompts.select(opts)).pipe(Effect.map((result) => optional(result)))

Callers 4

selectFunction · 0.70
autocompleteFunction · 0.70
textFunction · 0.70
passwordFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected