UNPKG

@yeoman/adapter

Version:

Input Output adapter for yeoman's generator/environment stack

54 lines (53 loc) 1.95 kB
/// <reference types="node" resolution-mode="require"/> /// <reference types="node" resolution-mode="require"/> import { createPromptModule } from 'inquirer'; import type { InputOutputAdapter, Logger, PromptAnswers, PromptQuestions } from '../types/index.js'; type PromptModule = ReturnType<typeof createPromptModule>; export type TerminalAdapterOptions = { promptModule?: PromptModule; stdin?: NodeJS.ReadStream; stdout?: NodeJS.WriteStream; stderr?: NodeJS.WriteStream; console?: Console; log?: any; }; export declare class TerminalAdapter implements InputOutputAdapter { stdin: NodeJS.ReadStream; stdout: NodeJS.WriteStream; stderr: NodeJS.WriteStream; console: Console; log: Logger; promptModule: PromptModule; private abortController; /** * `TerminalAdapter` is the default implementation of `Adapter`, an abstraction * layer that defines the I/O interactions. * * It provides a CLI interaction * * @constructor * @param {Object} [options] * @param {Console} [options.console] */ constructor(options?: TerminalAdapterOptions); get _colorDiffAdded(): import("chalk").ChalkInstance; get _colorDiffRemoved(): import("chalk").ChalkInstance; _colorLines(name: 'Added' | 'Removed', string: string): string; close(): void; /** * Prompt a user for one or more questions and pass * the answer(s) to the provided callback. * * It shares its interface with `Base.prompt` * * (Defined inside the constructor to keep interfaces separated between * instances) * * @param questions * @param answers Answers to be passed to inquirer * @return promise answers */ prompt<A extends PromptAnswers = PromptAnswers>(questions: PromptQuestions<A>, initialAnswers?: Partial<A>): Promise<A>; separator(separator?: string): import("@inquirer/core").Separator; } export {};