Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/lume/deps/cliffy.ts>GenericPrompt

🔥 Static site generator for Deno 🦕
Very Popular
Go to Latest
class GenericPrompt
Re-export
Abstract
import { GenericPrompt } from "https://deno.land/x/lume@v1.17.2/deps/cliffy.ts";

Generic prompt representation.

Constructors

new
protected
GenericPrompt(settings: TSettings)

Type Parameters

TValue
TRawValue

Properties

protected
readonly
cursor: Cursor
protected
readonly
indent: string
protected
readonly
settings: TSettings
protected
readonly
tty

Methods

protected
optional
body(): string | undefined | Promise<string | undefined>
protected
clear(): void

Clear prompt output.

protected
defaults(): string
protected
error(): string | undefined
protected
abstract
format(value: TValue): string

Format output value.

protected
abstract
getValue(): TRawValue

Get input value.

protected
handleEvent(event: KeyCode): Promise<void>

Handle user input event.

protected
hint(): string | undefined
protected
isKey<TKey extends unknown, TName extends keyof TKey>(
keys: TKey | undefined,
name: TName,
event: KeyCode,
): boolean

Check if key event has given name or sequence.

protected
message(): string
protected
read(): Promise<boolean>

Read user input from stdin, handle events and validate user input.

protected
render(): Promise<void>

Render prompt.

protected
setErrorMessage(message: string)
protected
submit(): Promise<void>
protected
success(value: TValue): string | undefined

Get prompt success message.

protected
abstract
transform(value: TRawValue): TValue | undefined

Map input value to output value.

protected
abstract
validate(value: TRawValue): ValidateResult

Validate input value.

prompt(): Promise<TValue>

Execute the prompt and show cursor on end.

Static Properties

protected
injectedValue: unknown | undefined

Static Methods

inject(value: unknown): void

Inject prompt value. Can be used for unit tests or pre selections.