@elsikora/setup-wizard
Version:
Setup Wizard - CLI scaffolding utility
105 lines (104 loc) • 4.74 kB
TypeScript
import type { ICliInterfaceService } from "../../application/interface/cli-interface-service.interface";
import type { ICliInterfaceServiceSelectOptions } from "../../domain/interface/cli-interface-service-select-options.interface";
/**
* Implementation of the CLI interface service using the Clack library.
* Provides methods for interacting with the user through the command line.
*/
export declare class ClackCliInterface implements ICliInterfaceService {
/** Reference to the active spinner instance */
private spinner;
/**
* Clears the console screen.
*/
clear(): void;
/**
* Displays a confirmation prompt to the user.
* @param message - The message to display to the user
* @param isConfirmedByDefault - The default value for the confirmation, defaults to false
* @returns Promise that resolves to the user's response (true for confirmed, false for declined)
*/
confirm(message: string, isConfirmedByDefault?: boolean): Promise<boolean>;
/**
* Displays an error message to the user.
* @param message - The error message to display
*/
error(message: string): void;
/**
* Displays a grouped multi-select prompt to the user.
* @param message - The message to display to the user
* @param options - Record of groups and their options
* @param isRequired - Whether a selection is required, defaults to false
* @param initialValues - Initial selected values
* @returns Promise that resolves to an array of selected values
*/
groupMultiselect<T>(message: string, options: Record<string, Array<ICliInterfaceServiceSelectOptions>>, isRequired?: boolean, initialValues?: Array<string>): Promise<Array<T>>;
/**
* Handles and displays an error message with additional error details.
* @param message - The error message to display
* @param error - The error object or details
*/
handleError(message: string, error: unknown): void;
/**
* Displays an informational message to the user.
* @param message - The info message to display
*/
info(message: string): void;
/**
* Displays a standard message to the user.
* @param message - The message to display
*/
log(message: string): void;
/**
* Displays a multi-select prompt to the user.
* @param message - The message to display to the user
* @param options - Array of options to select from
* @param isRequired - Whether a selection is required, defaults to false
* @param initialValues - Initial selected values
* @returns Promise that resolves to an array of selected values
*/
multiselect<T>(message: string, options: Array<ICliInterfaceServiceSelectOptions>, isRequired?: boolean, initialValues?: Array<string>): Promise<Array<T>>;
/**
* Displays a note to the user with a title and message.
* @param title - The title of the note
* @param message - The message content of the note
*/
note(title: string, message: string): void;
/**
* Displays a single select prompt to the user.
* @param message - The message to display to the user
* @param options - Array of options to select from
* @param initialValue - Initial selected value
* @returns Promise that resolves to the selected value
*/
select<T>(message: string, options: Array<ICliInterfaceServiceSelectOptions>, initialValue?: string): Promise<T>;
/**
* Starts a spinner with the specified message.
* Stops any existing spinner first.
* @param message - The message to display while the spinner is active
*/
startSpinner(message: string): void;
/**
* Stops the current spinner with an optional completion message.
* @param message - Optional message to display when the spinner stops
*/
stopSpinner(message?: string): void;
/**
* Displays a success message to the user.
* @param message - The success message to display
*/
success(message: string): void;
/**
* Displays a text input prompt to the user.
* @param message - The message to display to the user
* @param placeholder - Optional placeholder text for the input field
* @param initialValue - Optional initial value for the input field
* @param validate - Optional validation function for the input
* @returns Promise that resolves to the user's input text
*/
text(message: string, placeholder?: string, initialValue?: string, validate?: (value: string) => Error | string | undefined): Promise<string>;
/**
* Displays a warning message to the user.
* @param message - The warning message to display
*/
warn(message: string): void;
}