Skip to main content
Home

@optique/clack@1.2.0-dev.2329+7836254a
Built and signed on GitHub Actions

Works with
This package works with Node.js, Deno, Bun
This package works with Node.js
This package works with Deno
This package works with Bun
License
MIT
Downloads21/wk
Published2 weeks ago (1.2.0-dev.2329+7836254a)

Interactive prompt support for Optique via Clack

Functions

f
prompt<M extends Mode, TValue, TState>(
parser: Parser<M, TValue, TState>,
config: PromptConfig<TValue>
): FluentParser<"async", TValue, TState>

Wraps a parser with an interactive Clack prompt fallback.

Interfaces

I

Configuration for a confirm prompt.

  • initialValue: boolean

    Initial Boolean value.

  • message: string

    The question to display to the user.

  • prompter: () => Promise<boolean>

    Override the prompt execution. Useful for testing.

  • type: "confirm"
    No documentation available
I

Configuration for a multiselect prompt.

  • message: string

    The question to display to the user.

  • options: readonly (string | Option)[]

    Available options.

  • prompter: () => Promise<readonly string[]>

    Override the prompt execution. Useful for testing.

  • required: boolean

    Whether at least one option must be selected.

  • type: "multiselect"
    No documentation available
I

Configuration for a number prompt.

  • initialValue: number

    Initial numeric value.

  • max: number

    Maximum accepted value.

  • message: string

    The question to display to the user.

  • min: number

    Minimum accepted value.

  • placeholder: string

    Placeholder text shown before input.

  • prompter: () => Promise<number | undefined>

    Override the prompt execution. Useful for testing.

  • type: "number"
    No documentation available
  • validate: (value: number) => string | void | Promise<string | void>

    Additional validation after numeric conversion.

I

A choice item for select and multiselect prompts.

  • disabled: boolean | string

    If truthy, the option cannot be selected.

  • hint: string

    Additional hint shown next to the option.

  • label: string

    Display label shown in the prompt. Defaults to value.

  • value: string

    The value returned when this option is selected.

I

Configuration for a password prompt.

  • mask: string

    Mask character shown while typing.

  • message: string

    The question to display to the user.

  • prompter: () => Promise<string>

    Override the prompt execution. Useful for testing.

  • type: "password"
    No documentation available
  • validate: (value: string) => string | void | Promise<string | void>

    Validation function called when the user submits.

I

Configuration for a select prompt.

  • initialValue: string

    Initially selected option value.

  • message: string

    The question to display to the user.

  • options: readonly (string | Option)[]

    Available options.

  • prompter: () => Promise<string>

    Override the prompt execution. Useful for testing.

  • type: "select"
    No documentation available
I

Configuration for a text prompt.

  • initialValue: string

    Initial value pre-filled in the prompt.

  • message: string

    The question to display to the user.

  • placeholder: string

    Placeholder text shown before input.

  • prompter: () => Promise<string>

    Override the prompt execution. Useful for testing.

  • type: "text"
    No documentation available
  • validate: (value: string) => string | void | Promise<string | void>

    Validation function called when the user submits.

Type Aliases

T
PromptConfig<T> = BasePromptConfig<Exclude<T, null | undefined>>

Type-safe Clack prompt configuration for a given parser value type T.

T
StringPromptConfig = TextConfig | PasswordConfig | SelectConfig

A union of all string-valued prompt configurations.

Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@optique/clack

Import symbol

import * as mod from "@optique/clack";
or

Import directly with a jsr specifier

import * as mod from "jsr:@optique/clack";