1.0.12 • Published 11 months ago

@biggerstar/inquirer-selectable-table v1.0.12

Weekly downloads
-
License
ISC
Repository
github
Last release
11 months ago

inquirer-selectable-table npm version

A selectable table-like prompt for Inquirer.js

Screenshot of output

Screen capture of the selectable table prompt

Installation

npm install --save @biggerstar/inquirer-selectable-table

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("inquirer-selectable-table"));

inquirer
  .prompt([
    {
      type: "table",
      name: "people",
      message: "Choose your person of the week",
      columns: [
        {
          name: "firstName",
          value: "firstName",
        },
        {
          name: "lastName",
          value: "lastName",
        },
        {
          name: "location",
          value: "location",
        },
      ],
      rows: [
        {
          firstName: "Abel",
          lastName: "Nazeh",
          location: "Nigeria",
        },
        {
          firstName: "Daniel",
          lastName: "Ruiz",
          location: "Spain",
        },
        {
          firstName: "John",
          lastName: "Doe",
          location: "Leaf Village",
        },
        {
          firstName: "Kakashi",
          lastName: "Hatake",
          location: "Leaf Village",
        },
      ],
    },
  ])
  .then((answers) => {
    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
1.0.12

11 months ago

1.0.11

11 months ago

1.0.10

11 months ago

1.0.9

11 months ago

1.0.8

11 months ago

1.0.6

11 months ago

1.0.5

11 months ago

1.0.3

11 months ago

1.0.2

1 year ago

1.0.1

1 year ago