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

Function multiSelect

packages/cli/src/internal/prompt/multi-select.ts:306–326  ·  view source on GitHub ↗
(
  options: Prompt.Prompt.SelectOptions<A> & Prompt.Prompt.MultiSelectOptions
)

Source from the content-addressed store, hash-verified

304
305/** @internal */
306export const multiSelect = <const A>(
307 options: Prompt.Prompt.SelectOptions<A> & Prompt.Prompt.MultiSelectOptions
308): Prompt.Prompt<Array<A>> => {
309 const opts: SelectOptions<A> & MultiSelectOptions = {
310 maxPerPage: 10,
311 ...options
312 }
313 // Seed initial selection from choices marked as selected: true
314 const initialSelected = new Set<number>()
315 for (let i = 0; i < opts.choices.length; i++) {
316 const choice = opts.choices[i] as Prompt.Prompt.SelectChoice<A>
317 if (choice.selected === true) {
318 initialSelected.add(i)
319 }
320 }
321 return InternalPrompt.custom({ index: 0, selectedIndices: initialSelected, error: Option.none() }, {
322 render: handleRender(opts),
323 process: handleProcess(opts),
324 clear: () => handleClear(opts)
325 })
326}

Callers

nothing calls this directly

Calls 4

handleRenderFunction · 0.70
handleProcessFunction · 0.70
handleClearFunction · 0.70
addMethod · 0.65

Tested by

no test coverage detected