Skip to content

Function: ask()

ask(message, defaultValue?): string | null

Defined in: interaction.ts:148

Prompts the user to enter a text value. Returns the trimmed input, or null if the user cancelled.

Parameters

message

string

The message to display in the prompt dialog.

defaultValue?

string

An optional default value pre-filled in the input field.

Returns

string | null

Returns the trimmed user input, or null if cancelled.

Example

ts
const name = facile.ask('What is your name?');
if (name) {
  facile.say(`Hello, ${name}!`);
}