(options: FileOptionsReq)
| 2356 | } |
| 2357 | |
| 2358 | const handleFileClear = (options: FileOptionsReq) => { |
| 2359 | return Effect.fnUntraced(function*(state: FileState, _: Action<FileState, string>) { |
| 2360 | const terminal = yield* Terminal.Terminal |
| 2361 | const columns = yield* terminal.columns |
| 2362 | const path = yield* Path.Path |
| 2363 | const figures = yield* getTheme(options) |
| 2364 | const currentPath = yield* resolveCurrentPath(state.path, options) |
| 2365 | const selectedPath = state.files[state.cursor] |
| 2366 | const resolvedPath = selectedPath === undefined ? currentPath : path.resolve(currentPath, selectedPath) |
| 2367 | const resolvedPathText = separateSymbol(figures.pointerSmall, resolvedPath) |
| 2368 | const isConfirming = showConfirmation(state.confirm) |
| 2369 | const promptText = isConfirming |
| 2370 | ? renderPrompt("(Y/n)", CONFIRM_MESSAGE, figures.prefix, figures.pointerSmall, figures, { plain: true }) |
| 2371 | : renderPrompt( |
| 2372 | renderFileFilter(state, figures, { plain: true }), |
| 2373 | options.message, |
| 2374 | figures.tick, |
| 2375 | figures.ellipsis, |
| 2376 | figures, |
| 2377 | { |
| 2378 | plain: true |
| 2379 | } |
| 2380 | ) |
| 2381 | const filesText = isConfirming |
| 2382 | ? "" |
| 2383 | : renderFiles(state, state.files, figures, options, { plain: true }) |
| 2384 | const outputText = isConfirming |
| 2385 | ? `${promptText}\n${resolvedPathText}` |
| 2386 | : `${promptText}\n${resolvedPathText}\n${filesText}` |
| 2387 | const clearOutput = eraseText(outputText, columns) |
| 2388 | const resetCurrentLine = Ansi.eraseLine + Ansi.cursorLeft |
| 2389 | return clearOutput + resetCurrentLine |
| 2390 | }) |
| 2391 | } |
| 2392 | |
| 2393 | type RenderOptions = { |
| 2394 | readonly plain?: boolean |
no test coverage detected