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

x/alloy_folk/deps.ts>cliffy.GenericPrompt

An application installer for restriced macOS
Go to Latest
class cliffy.GenericPrompt
Re-export
Abstract
import { cliffy } from "https://deno.land/x/alloy_folk@v1.1.1/deps.ts";
const { GenericPrompt } = cliffy;

Generic prompt representation.

Constructors

new
protected
GenericPrompt(settings: S)

Properties

protected
readonly
cursor: Cursor
protected
readonly
indent: string
protected
readonly
settings: S
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: T): string

Format output value.

protected
abstract
getValue(): V

Get input value.

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

Handle user input event.

protected
hint(): string | undefined
protected
isKey<K extends unknown, N extends keyof K>(
keys: K | undefined,
name: N,
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: T): string | undefined

Get prompt success message.

protected
abstract
transform(value: V): T | undefined

Map input value to output value.

protected
abstract
validate(value: V): ValidateResult

Validate input value.

prompt(): Promise<T>

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.