🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

inquirer-table-prompt

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

inquirer-table-prompt

A table-like prompt for Inquirer

0.2.1
latest
Source
npm
Version published
Weekly downloads
1.7K
-16.84%
Maintainers
1
Weekly downloads
 
Created
Source

inquirer-table-prompt npm version

A table-like prompt for Inquirer.js

Screen capture of the table prompt

Installation

npm install --save inquirer-table-prompt

Usage

After registering the prompt, set any question to have type: "table" to make use of this prompt.

The result will be an array, containing the value for each row.

inquirer.registerPrompt("table", require("./index"));

inquirer
  .prompt([
    {
      type: "table",
      name: "workoutPlan",
      message: "Choose your workout plan for next week",
      columns: [
        {
          name: "Arms",
          value: "arms"
        },
        {
          name: "Legs",
          value: "legs"
        },
        {
          name: "Cardio",
          value: "cardio"
        },
        {
          name: "None",
          value: undefined
        }
      ],
      rows: [
        {
          name: "Monday",
          value: 0
        },
        {
          name: "Tuesday",
          value: 1
        },
        {
          name: "Wednesday",
          value: 2
        },
        {
          name: "Thursday",
          value: 3
        },
        {
          name: "Friday",
          value: 4
        },
        {
          name: "Saturday",
          value: 5
        },
        {
          name: "Sunday",
          value: 6
        }
      ]
    }
  ])
  .then(answers => {
    /*
    { workoutPlan:
      [ 'arms', 'legs', 'cardio', undefined, 'legs', 'arms', undefined ] }    
    */
    console.log(answers);
  });

Options

  • columns: Array of options to display as columns. Follows the same format as Inquirer's choices
  • rows: Array of options to display as rows. Follows the same format as Inquirer's choices
  • pageSize: Number of rows to display per page

Keywords

inquirer

FAQs

Package last updated on 23 Jan 2020

Did you know?

Socket

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