UNPKG

@yeoman/adapter

Version:

Input Output adapter for yeoman's generator/environment stack

53 lines (52 loc) 1.85 kB
import { Separator } from '@inquirer/core'; import type { InputOutputAdapter, Logger, PromptAnswers, PromptQuestions } from '../types/index.js'; import { PromptModule } from './inquirer.js'; 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; readonly signal: AbortSignal; /** * `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; abort(reason?: any): 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): Separator; }