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

Function renderFiles

packages/effect/src/cli/Prompt.ts:2475–2497  ·  view source on GitHub ↗
(
  state: FileState,
  files: ReadonlyArray<string>,
  figures: Theme,
  options: FileOptionsReq,
  renderOptions?: RenderOptions | undefined
)

Source from the content-addressed store, hash-verified

2473}
2474
2475const renderFiles = (
2476 state: FileState,
2477 files: ReadonlyArray<string>,
2478 figures: Theme,
2479 options: FileOptionsReq,
2480 renderOptions?: RenderOptions | undefined
2481) => {
2482 const length = files.length
2483 if (length === 0) {
2484 return renderOptions?.plain === true
2485 ? FILE_EMPTY_MESSAGE
2486 : Ansi.annotate(figures.colors, FILE_EMPTY_MESSAGE, figures.mutedColor)
2487 }
2488 const toDisplay = entriesToDisplay(state.cursor, length, options.maxPerPage)
2489 const documents: Array<string> = []
2490 for (let index = toDisplay.startIndex; index < toDisplay.endIndex; index++) {
2491 const isSelected = state.cursor === index
2492 const prefix = renderPrefix(state, toDisplay, index, length, figures, renderOptions)
2493 const fileName = renderFileName(files[index], isSelected, figures, renderOptions)
2494 documents.push(prefix + fileName)
2495 }
2496 return documents.join("\n")
2497}
2498
2499const renderFileNextFrame = Effect.fnUntraced(function*(state: FileState, options: FileOptionsReq) {
2500 const path = yield* Path.Path

Callers 2

handleFileClearFunction · 0.85
Prompt.tsFile · 0.85

Calls 6

entriesToDisplayFunction · 0.85
renderFileNameFunction · 0.85
renderPrefixFunction · 0.70
annotateMethod · 0.65
pushMethod · 0.65
joinMethod · 0.45

Tested by

no test coverage detected