API reference
confirm(options)
Prompts for Yes/No. Always writes options.message to stdout. On Windows with TTY and GUI, shows a native dialog; otherwise shows (Y/n) or (y/N) in the terminal.
Returns: Promise<"y" | "n">
Options:
Option |
Type |
Default |
Description |
|
string |
(required) |
Prompt text (always printed) |
|
string |
|
Dialog title (GUI only) |
|
|
|
Default when user presses Enter |
|
boolean |
|
If true, never use GUI |
|
ReadableStream |
|
Stream for terminal input |
|
WritableStream |
|
Stream for prompt output |
prompt(options)
Prompts for a single line of text. Always writes options.message to stdout.
Returns: Promise<string>
Options:
Option |
Type |
Default |
Description |
|
string |
(required) |
Prompt text (always printed) |
|
string |
|
Dialog title (GUI only) |
|
string |
|
Default/prefill value |
|
boolean |
|
If true, never use GUI |
|
ReadableStream |
|
Stream for terminal input |
|
WritableStream |
|
Stream for prompt output |