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

Function renderNumberError

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

Source from the content-addressed store, hash-verified

3015}
3016
3017const renderNumberError = (
3018 state: NumberState,
3019 pointer: string,
3020 theme: Theme,
3021 renderOptions?: RenderOptions | undefined
3022) => {
3023 if (Option.isSome(state.error)) {
3024 return Arr.match(state.error.value.split(NEWLINE_REGEXP), {
3025 onEmpty: () => "",
3026 onNonEmpty: (errorLines) => {
3027 if (renderOptions?.plain === true) {
3028 return separateSymbol(pointer, errorLines.join("\n"))
3029 }
3030 const prefix = annotateSymbol(theme, pointer, theme.errorColor)
3031 const lines = Arr.map(errorLines, (str) => annotateErrorLine(theme, str))
3032 return Ansi.cursorSavePosition + "\n" + separateSymbol(prefix, lines.join("\n")) + Ansi.cursorRestorePosition
3033 }
3034 })
3035 }
3036 return ""
3037}
3038
3039const renderNumberOutput = (
3040 state: NumberState,

Callers 2

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