UNPKG

@elsikora/setup-wizard

Version:

Setup Wizard - CLI scaffolding utility

110 lines 4.92 kB
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 Inquirer.js. * Provides user interaction capabilities through a command-line interface, * including prompts, confirmations, selections, and visual feedback. */ export declare class InquirerCliInterface implements ICliInterfaceService { /** Spinner for showing loading/processing states */ private readonly SPINNER; /** * Initializes a new instance of the InquirerCliInterface. * Sets up the spinner for providing visual feedback during operations. */ constructor(); /** * Clears the console screen. */ clear(): void; /** * Prompts the user with a yes/no confirmation question. * @param message - The question to ask the user * @param isConfirmedByDefault - Whether "Yes" should be the default option * @returns Promise resolving to true for "Yes" and false for "No" */ confirm(message: string, isConfirmedByDefault?: boolean): Promise<boolean>; /** * Displays an error message in red. * @param message - The error message to display */ error(message: string): void; /** * Prompts the user to select multiple options from grouped choices. * @param message - The prompt message to display * @param options - Record of group names to arrays of selection options * @param isRequired - Whether at least one selection is required * @param initialValues - Array of pre-selected values * @returns Promise resolving 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 with optional error details. * @param message - The error message to display * @param error - The error object with details */ handleError(message: string, error: unknown): void; /** * Displays an informational message in blue. * @param message - The information message to display */ info(message: string): void; /** * Displays a plain log message. * @param message - The message to log */ log(message: string): void; /** * Prompts the user to select multiple options from choices. * @param message - The prompt message to display * @param options - Array of selection options * @param isRequired - Whether at least one selection is required * @param initialValues - Array of pre-selected values * @returns Promise resolving to an array of selected values */ multiselect<T>(message: string, options: Array<ICliInterfaceServiceSelectOptions>, isRequired?: boolean, initialValues?: Array<string>): Promise<Array<T>>; /** * Displays a note with a bold title and message. * @param title - The bold title of the note * @param message - The message content of the note */ note(title: string, message: string): void; /** * Prompts the user to select a single option from choices. * @param message - The prompt message to display * @param options - Array of selection options * @param initialValue - Pre-selected value * @returns Promise resolving to the selected value */ select<T>(message: string, options: Array<ICliInterfaceServiceSelectOptions>, initialValue?: string): Promise<T>; /** * Starts a spinner with a message to indicate ongoing operation. * @param message - The message to display alongside the spinner */ startSpinner(message: string): void; /** * Stops the spinner and optionally displays a completion message. * @param message - Optional message to display after stopping the spinner */ stopSpinner(message?: string): void; /** * Displays a success message in green. * @param message - The success message to display */ success(message: string): void; /** * Prompts the user for text input. * @param message - The prompt message to display * @param _placeholder - Optional placeholder text * @param initialValue - Optional initial value for the input * @param validate - Optional validation function for the input * @returns Promise resolving to the entered text */ text(message: string, _placeholder?: string, initialValue?: string, validate?: (value: string) => Error | string | undefined): Promise<string>; /** * Displays a warning message in yellow. * @param message - The warning message to display */ warn(message: string): void; } //# sourceMappingURL=inquirer-cli-interface.service.d.ts.map