inquirer

  • Version 12.2.0
  • Published
  • 71.7 kB
  • 7 dependencies
  • MIT license

Install

npm i inquirer
yarn add inquirer
pnpm add inquirer

Overview

A collection of common interactive command line user interfaces.

Index

Variables

variable A

const A: any;

    variable A

    const A: any;

      variable Answers

      const Answers: any;

        variable Answers

        const Answers: boolean;

          variable Answers

          const Answers: any;

            variable Answers

            const Answers: boolean;

              variable inquirer

              const inquirer: { prompt: { () } };

                variable PrefilledAnswers

                const PrefilledAnswers: any;

                  variable PrefilledAnswers

                  const PrefilledAnswers: any;

                    Functions

                    function createPromptModule

                    createPromptModule: <
                    Prompts extends Record<string, Record<string, unknown>> = never
                    >(
                    opt?: Prettify<any>
                    ) => { () };
                    • Create a new self-contained prompt module.

                    function registerPrompt

                    registerPrompt: (name: string, newPrompt: LegacyPromptConstructor) => void;

                      function restoreDefaultPrompts

                      restoreDefaultPrompts: () => void;

                        Interfaces

                        interface QuestionMap

                        interface QuestionMap {}
                        • Allows to inject a custom question type into inquirer module.

                          Example 1

                          declare module 'inquirer' {
                          interface QuestionMap {
                          custom: { message: string };
                          }
                          }

                          Globally defined question types are not correct.

                        Type Aliases

                        type Answers

                        type Answers<Key extends string = string> = Record<Key, any>;

                          type DistinctQuestion

                          type DistinctQuestion<A extends Answers = Answers> = Prettify<
                          UnnamedDistinctQuestion<A> & {
                          name: Extract<keyof A, string>;
                          }
                          >;

                            type PromptSession

                            type PromptSession<
                            A extends Answers = Answers,
                            Q extends Question<A> = Question<A>
                            > = Q[] | Record<string, Omit<Q, 'name'>> | Observable<Q> | Q;

                              type Question

                              type Question<A extends Answers = Answers, Type extends string = string> = {
                              type: Type;
                              name: string;
                              message: string | AsyncGetterFunction<string, A>;
                              default?: any;
                              choices?: any;
                              filter?: (answer: any, answers: Partial<A>) => any;
                              askAnswered?: boolean;
                              when?: boolean | AsyncGetterFunction<boolean, A>;
                              };

                                Package Files (2)

                                Dependencies (7)

                                Dev Dependencies (4)

                                Peer Dependencies (1)

                                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/inquirer.

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