(options: FileOptionsReq)
| 2194 | } |
| 2195 | |
| 2196 | const handleFileClear = (options: FileOptionsReq) => { |
| 2197 | return Effect.fnUntraced(function*(state: FileState, _: Action<FileState, string>) { |
| 2198 | const terminal = yield* Terminal.Terminal |
| 2199 | const columns = yield* terminal.columns |
| 2200 | const path = yield* Path.Path |
| 2201 | const figures = yield* platformFigures |
| 2202 | const currentPath = yield* resolveCurrentPath(state.path, options) |
| 2203 | const selectedPath = state.files[state.cursor] |
| 2204 | const resolvedPath = selectedPath === undefined ? currentPath : path.resolve(currentPath, selectedPath) |
| 2205 | const resolvedPathText = `${figures.pointerSmall} ${resolvedPath}` |
| 2206 | const isConfirming = showConfirmation(state.confirm) |
| 2207 | const promptText = isConfirming |
| 2208 | ? renderPrompt("(Y/n)", CONFIRM_MESSAGE, "?", figures.pointerSmall, { plain: true }) |
| 2209 | : renderPrompt(renderFileFilter(state, { plain: true }), options.message, figures.tick, figures.ellipsis, { |
| 2210 | plain: true |
| 2211 | }) |
| 2212 | const filesText = isConfirming |
| 2213 | ? "" |
| 2214 | : renderFiles(state, state.files, figures, options, { plain: true }) |
| 2215 | const outputText = isConfirming |
| 2216 | ? `${promptText}\n${resolvedPathText}` |
| 2217 | : `${promptText}\n${resolvedPathText}\n${filesText}` |
| 2218 | const clearOutput = eraseText(outputText, columns) |
| 2219 | const resetCurrentLine = Ansi.eraseLine + Ansi.cursorLeft |
| 2220 | return clearOutput + resetCurrentLine |
| 2221 | }) |
| 2222 | } |
| 2223 | |
| 2224 | type RenderOptions = { |
| 2225 | readonly plain?: boolean |
no test coverage detected