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

Function renderMultiSelectError

packages/effect/src/unstable/cli/Prompt.ts:2516–2535  ·  view source on GitHub ↗
(
  state: MultiSelectState,
  pointer: string,
  renderOptions?: RenderOptions | undefined
)

Source from the content-addressed store, hash-verified

2514}
2515
2516const renderMultiSelectError = (
2517 state: MultiSelectState,
2518 pointer: string,
2519 renderOptions?: RenderOptions | undefined
2520): string => {
2521 if (Option.isSome(state.error)) {
2522 return Arr.match(state.error.value.split(NEWLINE_REGEXP), {
2523 onEmpty: () => "",
2524 onNonEmpty: (errorLines) => {
2525 if (renderOptions?.plain === true) {
2526 return `${pointer} ${errorLines.join("\n")}`
2527 }
2528 const prefix = Ansi.annotate(pointer, Ansi.red) + " "
2529 const lines = Arr.map(errorLines, (str) => annotateErrorLine(str))
2530 return Ansi.cursorSavePosition + "\n" + prefix + lines.join("\n") + Ansi.cursorRestorePosition
2531 }
2532 })
2533 }
2534 return ""
2535}
2536
2537const renderChoiceDescription = <A>(
2538 choice: SelectChoice<A>,

Callers 2

Prompt.tsFile · 0.85
handleMultiSelectClearFunction · 0.85

Calls 5

annotateErrorLineFunction · 0.85
joinMethod · 0.80
annotateMethod · 0.65
splitMethod · 0.45
mapMethod · 0.45

Tested by

no test coverage detected