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

Function renderSelectChoices

packages/effect/src/unstable/cli/Prompt.ts:3205–3223  ·  view source on GitHub ↗
(
  state: SelectState,
  options: SelectOptionsReq<A>,
  figures: Effect.Success<typeof platformFigures>,
  renderOptions?: RenderOptions | undefined
)

Source from the content-addressed store, hash-verified

3203}
3204
3205const renderSelectChoices = <A>(
3206 state: SelectState,
3207 options: SelectOptionsReq<A>,
3208 figures: Effect.Success<typeof platformFigures>,
3209 renderOptions?: RenderOptions | undefined
3210) => {
3211 const choices = options.choices
3212 const toDisplay = entriesToDisplay(state, choices.length, options.maxPerPage)
3213 const documents: Array<string> = []
3214 for (let index = toDisplay.startIndex; index < toDisplay.endIndex; index++) {
3215 const choice = choices[index]
3216 const isSelected = state === index
3217 const prefix = renderChoicePrefix(state, choices, toDisplay, index, figures, renderOptions)
3218 const title = renderChoiceTitle(choice, isSelected, renderOptions)
3219 const description = renderChoiceDescription(choice, isSelected, renderOptions)
3220 documents.push(prefix + title + " " + description)
3221 }
3222 return documents.join("\n")
3223}
3224
3225const renderAutoCompleteChoices = <A>(
3226 state: AutoCompleteState,

Callers 2

Prompt.tsFile · 0.85
handleSelectClearFunction · 0.85

Calls 6

entriesToDisplayFunction · 0.85
renderChoicePrefixFunction · 0.85
renderChoiceTitleFunction · 0.85
renderChoiceDescriptionFunction · 0.85
pushMethod · 0.80
joinMethod · 0.80

Tested by

no test coverage detected