enquirer

  • Version 2.4.1
  • Published
  • 189 kB
  • 2 dependencies
  • MIT license

Install

npm i enquirer
yarn add enquirer
pnpm add enquirer

Overview

Stylish, intuitive and user-friendly prompt system. Fast and lightweight enough for small projects, powerful and extensible enough for the most advanced use cases.

Index

Functions

function prompt

prompt: <T = object>(
questions:
| PromptOptions
| ((this: Enquirer) => PromptOptions)
| (PromptOptions | ((this: Enquirer) => PromptOptions))[]
) => Promise<T>;

    Classes

    class Enquirer

    class Enquirer<T = object> extends EventEmitter {}

      constructor

      constructor(options?: {}, answers?: {});

        method prompt

        prompt: (
        questions:
        | PromptOptions
        | ((this: Enquirer) => PromptOptions)
        | (PromptOptions | ((this: Enquirer) => PromptOptions))[]
        ) => Promise<T>;
        • Prompt function that takes a "question" object or array of question objects, and returns an object with responses from the user.

          Parameter questions

          Options objects for one or more prompts to run.

        method register

        register: {
        (type: string, fn: typeof BasePrompt | (() => typeof BasePrompt)): this;
        (type: {
        [key: string]: typeof BasePrompt | (() => typeof BasePrompt);
        }): this;
        };
        • Register a custom prompt type.

          Parameter type

          Parameter fn

          Prompt class, or a function that returns a Prompt class.

        • Register a custom prompt type.

        method use

        use: (plugin: (this: this, enquirer: this) => void) => this;
        • Use an enquirer plugin.

          Parameter plugin

          Plugin function that takes an instance of Enquirer.

        class Prompt

        class Prompt extends BasePrompt {}

          Package Files (1)

          Dependencies (2)

          Dev Dependencies (8)

          Peer Dependencies (0)

          No peer dependencies.

          Badge

          To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

          You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/enquirer.

          • Markdown
            [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/enquirer)
          • HTML
            <a href="https://www.jsdocs.io/package/enquirer"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>