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

Function renderNextFrame

packages/cli/src/internal/prompt/file.ts:176–217  ·  view source on GitHub ↗
(state: State, options: FileOptions)

Source from the content-addressed store, hash-verified

174}
175
176function renderNextFrame(state: State, options: FileOptions) {
177 return Effect.gen(function*() {
178 const path = yield* Path.Path
179 const terminal = yield* Terminal.Terminal
180 const columns = yield* terminal.columns
181 const figures = yield* InternalAnsiUtils.figures
182 const currentPath = yield* resolveCurrentPath(state.path, options)
183 const selectedPath = state.files[state.cursor]
184 const resolvedPath = path.resolve(currentPath, selectedPath)
185 const resolvedPathMsg = figures.pointerSmall.pipe(
186 Doc.cat(Doc.space),
187 Doc.cat(Doc.text(resolvedPath)),
188 Doc.annotate(Ansi.blackBright)
189 )
190 if (showConfirmation(state.confirm)) {
191 const leadingSymbol = Doc.annotate(Doc.text("?"), Ansi.cyanBright)
192 const trailingSymbol = Doc.annotate(figures.pointerSmall, Ansi.blackBright)
193 const confirm = Doc.annotate(Doc.text("(Y/n)"), Ansi.blackBright)
194 const promptMsg = renderPrompt(confirm, CONFIRM_MESSAGE, leadingSymbol, trailingSymbol)
195 return Doc.cursorHide.pipe(
196 Doc.cat(promptMsg),
197 Doc.cat(Doc.hardLine),
198 Doc.cat(resolvedPathMsg),
199 Optimize.optimize(Optimize.Deep),
200 Doc.render({ style: "pretty", options: { lineWidth: columns } })
201 )
202 }
203 const leadingSymbol = Doc.annotate(figures.tick, Ansi.green)
204 const trailingSymbol = Doc.annotate(figures.ellipsis, Ansi.blackBright)
205 const promptMsg = renderPrompt(Doc.empty, options.message, leadingSymbol, trailingSymbol)
206 const files = renderFiles(state, state.files, figures, options)
207 return Doc.cursorHide.pipe(
208 Doc.cat(promptMsg),
209 Doc.cat(Doc.hardLine),
210 Doc.cat(resolvedPathMsg),
211 Doc.cat(Doc.hardLine),
212 Doc.cat(files),
213 Optimize.optimize(Optimize.Deep),
214 Doc.render({ style: "pretty", options: { lineWidth: columns } })
215 )
216 })
217}
218
219function renderSubmission(value: string, options: FileOptions) {
220 return Effect.gen(function*() {

Callers 1

handleRenderFunction · 0.70

Calls 6

resolveCurrentPathFunction · 0.85
renderPromptFunction · 0.85
renderFilesFunction · 0.85
pipeMethod · 0.65
annotateMethod · 0.65
textMethod · 0.45

Tested by

no test coverage detected