Socket
Socket
Sign inDemoInstall

inquirerer

Package Overview
Dependencies
4
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    inquirerer

inquirerer


Version published
Weekly downloads
10K
decreased by-8.15%
Maintainers
1
Install size
819 kB
Created
Weekly downloads
 

Readme

Source

inquirerer

This library is designed to facilitate the creation of command-line utilities by providing a robust framework for capturing user input through interactive prompts. It supports a variety of question types, making it highly flexible and suitable for a wide range of applications.

This is the new and improved version of pyramation/inquirer. Soon this will completely replace it!

Install

npm install inquirerer

Features

  • 🖊 Multiple Question Types: Support for text, autocomplete, checkbox, and confirm questions.
  • 🛠 Customizable Prompts: Easily configure prompts to include default values, requirement flags, and custom validation rules.
  • 🔎 Interactive Autocomplete: Dynamically filter options based on user input.
  • ✔️ Flexible Checkbox Selections: Allow users to select multiple options from a list.

Table of Contents

Installation

To install the library, use npm or yarn:

npm install inquirerer

Usage

Import the library and use it to create prompts for your command-line application:

import { Inquirerer } from 'inquirerer';

Example Questions

Here are several examples of different question types you can use:

Text Question
{
  type: 'text',
  name: 'firstName',
  message: 'Enter your first name',
}
Confirm Question
{
  type: 'confirm',
  name: 'continue',
  message: 'Do you wish to continue?',
  default: true,
}
Autocomplete Question
{
  type: 'autocomplete',
  name: 'fruitChoice',
  message: 'Select your favorite fruit',
  options: [
    'Apple', 'Banana', 'Cherry'
  ],
  maxDisplayLines: 5
}
Checkbox Question
{
  type: 'checkbox',
  name: 'techStack',
  message: 'Choose your tech stack',
  options: [
    'Node.js', 'React', 'Angular', 'Vue.js'
  ],
  returnFullResults: false,
  required: true
}

Executing a Prompt

To run a prompt and handle the response:

const prompter = new Inquirerer();

async function runPrompt() {
  const responses = await prompter.prompt({}, [
    {
      type: 'text',
      name: 'lastName',
      message: 'Enter your last name',
      required: true
    },
    {
      type: 'checkbox',
      name: 'devTools',
      message: 'Select development tools:',
      options: ['VS Code', 'Sublime', 'Atom'],
      required: true
    }
  ]);

  console.log(responses);
}

runPrompt();

Developing

When first cloning the repo:

yarn
yarn build

Disclaimer

AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED “AS IS”, AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND.

No developer or entity involved in creating this software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the code, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value.

FAQs

Last updated on 30 Apr 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc