@xec-sh/core
Version:
Universal shell execution engine
45 lines (44 loc) • 1.87 kB
TypeScript
import { Readable, Writable } from 'node:stream';
import type { ExecutionEngine } from '../core/execution-engine.js';
export interface QuestionOptions {
defaultValue?: string;
choices?: string[];
validate?: (input: string) => boolean | string;
mask?: boolean;
multiline?: boolean;
}
export interface PromptOptions {
input?: Readable;
output?: Writable;
terminal?: boolean;
}
export declare class InteractiveSession {
private engine;
private options;
private rl;
constructor(engine: ExecutionEngine, options?: PromptOptions);
question(prompt: string, options?: QuestionOptions): Promise<string>;
confirm(prompt: string, defaultValue?: boolean): Promise<boolean>;
select(prompt: string, choices: string[]): Promise<string>;
multiselect(prompt: string, choices: string[]): Promise<string[]>;
password(prompt: string): Promise<string>;
close(): void;
}
export declare function question(engine: ExecutionEngine, prompt: string, options?: QuestionOptions): Promise<string>;
export declare function confirm(engine: ExecutionEngine, prompt: string, defaultValue?: boolean): Promise<boolean>;
export declare function select(engine: ExecutionEngine, prompt: string, choices: string[]): Promise<string>;
export declare function password(engine: ExecutionEngine, prompt: string): Promise<string>;
export declare class Spinner {
private frames;
private currentFrame;
private interval;
private text;
constructor(text?: string);
start(text?: string): void;
update(text: string): void;
succeed(text?: string): void;
fail(text?: string): void;
stop(): void;
}
export declare function withSpinner<T>(text: string, fn: () => T | Promise<T>): Promise<T>;
export { type InteractiveOptions, createInteractiveSession, type InteractiveSessionAPI } from './interactive-process.js';