| 1 | /** |
| 2 | * Deno-backed implementation of Effect's `Terminal` service. |
| 3 | * |
| 4 | * This module reuses the shared Node terminal implementation for Deno. `make` |
| 5 | * creates a scoped process-backed `Terminal` service, and `layer` provides the |
| 6 | * default terminal service with the standard quit behavior for key input. |
| 7 | * |
| 8 | * @since 4.0.0 |
| 9 | */ |
| 10 | import * as NodeTerminal from "@effect/platform-node-shared/NodeTerminal" |
| 11 | import type { Effect } from "effect/Effect" |
| 12 | import type { Layer } from "effect/Layer" |
| 13 | import type { Scope } from "effect/Scope" |
| 14 | import type { Terminal, UserInput } from "effect/Terminal" |
| 15 | |
| 16 | /** |
| 17 | * Creates a scoped `Terminal` service backed by process stdin/stdout, using the |
| 18 | * optional predicate to decide when key input should end the input stream. |
| 19 | * |
| 20 | * @category constructors |
| 21 | * @since 4.0.0 |
| 22 | */ |
| 23 | export const make: (shouldQuit?: (input: UserInput) => boolean) => Effect<Terminal, never, Scope> = NodeTerminal.make |
| 24 | |
| 25 | /** |
| 26 | * Provides the default process-backed `Terminal` service, ending key input on |
| 27 | * the default quit keys. |
| 28 | * |
| 29 | * @category layers |
| 30 | * @since 4.0.0 |
| 31 | */ |
| 32 | export const layer: Layer<Terminal> = NodeTerminal.layer |