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

Function renderFiles

packages/effect/src/unstable/cli/Prompt.ts:2290–2312  ·  view source on GitHub ↗
(
  state: FileState,
  files: ReadonlyArray<string>,
  figures: Effect.Success<typeof platformFigures>,
  options: FileOptionsReq,
  renderOptions?: RenderOptions | undefined
)

Source from the content-addressed store, hash-verified

2288}
2289
2290const renderFiles = (
2291 state: FileState,
2292 files: ReadonlyArray<string>,
2293 figures: Effect.Success<typeof platformFigures>,
2294 options: FileOptionsReq,
2295 renderOptions?: RenderOptions | undefined
2296) => {
2297 const length = files.length
2298 if (length === 0) {
2299 return renderOptions?.plain === true
2300 ? FILE_EMPTY_MESSAGE
2301 : Ansi.annotate(FILE_EMPTY_MESSAGE, Ansi.blackBright)
2302 }
2303 const toDisplay = entriesToDisplay(state.cursor, length, options.maxPerPage)
2304 const documents: Array<string> = []
2305 for (let index = toDisplay.startIndex; index < toDisplay.endIndex; index++) {
2306 const isSelected = state.cursor === index
2307 const prefix = renderPrefix(state, toDisplay, index, length, figures, renderOptions)
2308 const fileName = renderFileName(files[index], isSelected, renderOptions)
2309 documents.push(prefix + fileName)
2310 }
2311 return documents.join("\n")
2312}
2313
2314const renderFileNextFrame = Effect.fnUntraced(function*(state: FileState, options: FileOptionsReq) {
2315 const path = yield* Path.Path

Callers 2

handleFileClearFunction · 0.85
Prompt.tsFile · 0.85

Calls 6

entriesToDisplayFunction · 0.85
renderPrefixFunction · 0.85
renderFileNameFunction · 0.85
pushMethod · 0.80
joinMethod · 0.80
annotateMethod · 0.65

Tested by

no test coverage detected