Skip to main content
Module

x/cliffy/prompt/confirm.ts>Confirm

Command line framework for deno 🦕 Including Commandline-Interfaces, Prompts, CLI-Table, Arguments Parser and more...
Extremely Popular
Latest
class Confirm
extends GenericSuggestions<boolean, string>
import { Confirm } from "https://deno.land/x/cliffy@v1.0.0-rc.4/prompt/confirm.ts";

Confirm prompt representation.

import { Confirm } from "./mod.ts";

const confirmed: boolean = await Confirm.prompt("Please confirm");

Constructors

new
Confirm(options: string | ConfirmOptions)

Properties

protected
readonly
settings: ConfirmSettings

Methods

protected
defaults(): string
protected
format(value: boolean): string

Format output value.

protected
getValue(): string

Get input input.

protected
success(value: boolean): string | undefined
protected
transform(value: string): boolean | undefined

Map input value to output value.

protected
validate(value: string): boolean | string

Validate input value.

getDefaultSettings(options: ConfirmOptions): ConfirmSettings

Static Methods

inject(value: string): void

Inject prompt value. If called, the prompt doesn't prompt for an input and returns immediately the injected value. Can be used for unit tests or pre selections.

prompt(options: string | ConfirmOptions): Promise<boolean>

Execute the prompt with provided options.