@stacksjs/clapp
Version:
A toolkit for building CLI prompts in TypeScript.
47 lines • 1.23 kB
TypeScript
import { } from './common';
import type { CommonOptions } from './common';
export declare function select<Value>(opts: SelectOptions<Value>): void;
export declare interface SelectOptions<Value> extends CommonOptions {
message: string
options: Option<Value>[]
initialValue?: Value
maxItems?: number
}
declare type Primitive = Readonly<string | boolean | number>
export type Option<Value> = Value extends Primitive
? {
/**
* Internal data for this option.
*/
value: Value
/**
* The optional, user-facing text for this option.
*
* By default, the `value` is converted to a string.
*/
label?: string
/**
* An optional hint to display to the user when
* this option might be selected.
*
* By default, no `hint` is displayed.
*/
hint?: string
}
: {
/**
* Internal data for this option.
*/
value: Value
/**
* Required. The user-facing text for this option.
*/
label: string
/**
* An optional hint to display to the user when
* this option might be selected.
*
* By default, no `hint` is displayed.
*/
hint?: string
}