Skip to main content
Module

x/ask/mod.ts>default

interactive command-line prompts for deno
Latest
class default
import { default } from "https://deno.land/x/ask@1.0.6/mod.ts";

Constructors

new
default(opts?: GlobalPromptOpts)

Creates an ask instance. You can pass global options to it to customize behavior across all questions.

Methods

confirm(opts: ConfirmOpts): Promise<Result<boolean>>

Will ask a yes/no question and return an object with a single property, which is the name of the question. The value is a boolean, depending on the provided answer.

input(opts: PromptOpts): Promise<Result<string | undefined>>

Will ask for a string input and will return an object with a single property, which is the name of the question. The value is a string or undefined.

number(opts: NumberOpts): Promise<Result<number>>

Will ask for a number input and will return an object with a single property, which is the name of the question. The value is a number.

prompt(questions: Array<PromptOpts | ConfirmOpts | NumberOpts>): Promise<Result<
| string
| number
| boolean
| undefined
>>

Takes an array of prompts, which can be of multiple differing types. Will return an object where each key corresponds to the name of each individual question and the values are results, depending on the type of the question.