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

Function renderNumberError

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

Source from the content-addressed store, hash-verified

2789}
2790
2791const renderNumberError = (
2792 state: NumberState,
2793 pointer: string,
2794 renderOptions?: RenderOptions | undefined
2795) => {
2796 if (Option.isSome(state.error)) {
2797 return Arr.match(state.error.value.split(NEWLINE_REGEXP), {
2798 onEmpty: () => "",
2799 onNonEmpty: (errorLines) => {
2800 if (renderOptions?.plain === true) {
2801 return `${pointer} ${errorLines.join("\n")}`
2802 }
2803 const prefix = Ansi.annotate(pointer, Ansi.red) + " "
2804 const lines = Arr.map(errorLines, (str) => annotateErrorLine(str))
2805 return Ansi.cursorSavePosition + "\n" + prefix + lines.join("\n") + Ansi.cursorRestorePosition
2806 }
2807 })
2808 }
2809 return ""
2810}
2811
2812const renderNumberOutput = (
2813 state: NumberState,

Callers 2

handleNumberClearFunction · 0.85
Prompt.tsFile · 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