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

Function renderMultiSelectError

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

Source from the content-addressed store, hash-verified

2728}
2729
2730const renderMultiSelectError = (
2731 state: MultiSelectState,
2732 pointer: string,
2733 theme: Theme,
2734 renderOptions?: RenderOptions | undefined
2735): string => {
2736 if (Option.isSome(state.error)) {
2737 return Arr.match(state.error.value.split(NEWLINE_REGEXP), {
2738 onEmpty: () => "",
2739 onNonEmpty: (errorLines) => {
2740 if (renderOptions?.plain === true) {
2741 return separateSymbol(pointer, errorLines.join("\n"))
2742 }
2743 const prefix = annotateSymbol(theme, pointer, theme.errorColor)
2744 const lines = Arr.map(errorLines, (str) => annotateErrorLine(theme, str))
2745 return Ansi.cursorSavePosition + "\n" + separateSymbol(prefix, lines.join("\n")) + Ansi.cursorRestorePosition
2746 }
2747 })
2748 }
2749 return ""
2750}
2751
2752const renderChoiceDescription = <A>(
2753 choice: SelectChoice<A>,

Callers 2

Prompt.tsFile · 0.85
handleMultiSelectClearFunction · 0.85

Calls 6

separateSymbolFunction · 0.85
annotateSymbolFunction · 0.85
annotateErrorLineFunction · 0.85
splitMethod · 0.45
joinMethod · 0.45
mapMethod · 0.45

Tested by

no test coverage detected