dax
Version:
Cross platform shell tools inspired by zx.
26 lines • 1.07 kB
TypeScript
import { SelectionItem, type SelectionOptions } from "./utils.js";
/** Options for showing a selection that only has one result. */
export interface SelectOptions {
/** Prompt text to show the user. */
message: string;
/** Initial selected option index. Defaults to 0. */
initialIndex?: number;
/** Options to show the user. */
options: string[];
/**
* Whether to not clear the selection text on selection.
* @default `false`
*/
noClear?: boolean;
/**
* Signal that cancels the prompt.
*
* - `maybeSelect`: resolves to `undefined` on abort (same as ctrl+c).
* - `select`: the returned promise rejects with `signal.reason`.
*/
signal?: AbortSignal;
}
export declare function select(opts: SelectOptions): Promise<SelectionItem>;
export declare function maybeSelect(opts: SelectOptions): Promise<SelectionItem | undefined>;
export declare function innerSelect(opts: SelectOptions): Pick<SelectionOptions<SelectionItem | undefined>, "render" | "onKey">;
//# sourceMappingURL=select.d.ts.map