(options: FileOptionsReq)
| 2432 | }) |
| 2433 | |
| 2434 | const handleFileProcess = (options: FileOptionsReq) => { |
| 2435 | return Effect.fnUntraced(function*(input: Terminal.UserInput, state: FileState) { |
| 2436 | if (input.key.ctrl) { |
| 2437 | if (input.key.name === "u") { |
| 2438 | if (showConfirmation(state.confirm)) { |
| 2439 | return Action.Beep() |
| 2440 | } |
| 2441 | return yield* processFileClear(state) |
| 2442 | } |
| 2443 | return Action.Beep() |
| 2444 | } |
| 2445 | switch (input.key.name) { |
| 2446 | case "k": |
| 2447 | case "up": { |
| 2448 | return yield* processFileCursorUp(state) |
| 2449 | } |
| 2450 | case "j": |
| 2451 | case "down": |
| 2452 | case "tab": { |
| 2453 | return yield* processFileCursorDown(state) |
| 2454 | } |
| 2455 | case "backspace": { |
| 2456 | if (showConfirmation(state.confirm)) { |
| 2457 | return Action.Beep() |
| 2458 | } |
| 2459 | return yield* processFileBackspace(state) |
| 2460 | } |
| 2461 | case "enter": |
| 2462 | case "return": { |
| 2463 | return yield* processSelection(state, options) |
| 2464 | } |
| 2465 | case "y": |
| 2466 | case "t": { |
| 2467 | if (showConfirmation(state.confirm)) { |
| 2468 | const path = yield* Path.Path |
| 2469 | const currentPath = yield* resolveCurrentPath(state.path, options) |
| 2470 | const selectedPath = state.files[state.cursor] |
| 2471 | const resolvedPath = path.resolve(currentPath, selectedPath) |
| 2472 | const files = yield* getFileList(resolvedPath, options) |
| 2473 | return Action.NextFrame({ |
| 2474 | state: { |
| 2475 | cursor: 0, |
| 2476 | files, |
| 2477 | allFiles: files, |
| 2478 | query: "", |
| 2479 | path: Option.some(resolvedPath), |
| 2480 | confirm: Confirm.Hide() |
| 2481 | } |
| 2482 | }) |
| 2483 | } |
| 2484 | return yield* processFileInput(Option.getOrElse(input.input, () => ""), state) |
| 2485 | } |
| 2486 | case "n": |
| 2487 | case "f": { |
| 2488 | if (showConfirmation(state.confirm)) { |
| 2489 | const path = yield* Path.Path |
| 2490 | const currentPath = yield* resolveCurrentPath(state.path, options) |
| 2491 | const selectedPath = state.files[state.cursor] |
no test coverage detected