MCPcopy Create free account
hub / github.com/effect-app/libs / multiSelect

Function multiSelect

repos/effect/packages/effect/src/unstable/cli/Prompt.ts:1194–1215  ·  view source on GitHub ↗
(
  options: SelectOptions<A> & MultiSelectOptions
)

Source from the content-addressed store, hash-verified

1192 self: Prompt<Output>
1193) => Effect.Effect<
1194 Output,
1195 Terminal.QuitError,
1196 Environment
1197> = Effect.fnUntraced(
1198 function*<Output>(self: Prompt<Output>) {
1199 const terminal = yield* Terminal.Terminal
1200 const input = yield* terminal.readInput
1201 return yield* runWithInput(self, terminal, input)
1202 },
1203 Effect.mapError(() => new Terminal.QuitError({})),
1204 Effect.scoped
1205)
1206
1207const getSelectInitialIndex = <A>(choices: ReadonlyArray<SelectChoice<A>>): number => {
1208 let initialIndex = 0
1209 let seenSelected = -1
1210 for (let i = 0; i < choices.length; i++) {
1211 const choice = choices[i] as SelectChoice<A>
1212 if (choice.selected === true) {
1213 if (seenSelected !== -1) {
1214 throw new Error("InvalidArgumentException: only a single choice can be selected by default for Prompt.Select")
1215 }
1216 seenSelected = i
1217 }
1218 }

Callers

nothing calls this directly

Calls 5

handleMultiSelectRenderFunction · 0.85
handleMultiSelectProcessFunction · 0.85
handleMultiSelectClearFunction · 0.85
customFunction · 0.70
addMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…