Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shazron/inquirer-table-prompt
A table-like prompt for Inquirer
https://github.com/shazron/inquirer-table-prompt
Last synced: 3 months ago
JSON representation
A table-like prompt for Inquirer
- Host: GitHub
- URL: https://github.com/shazron/inquirer-table-prompt
- Owner: shazron
- Fork: true (eduardoboucas/inquirer-table-prompt)
- Created: 2022-06-22T08:12:44.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-09-19T12:49:47.000Z (over 2 years ago)
- Last Synced: 2023-04-01T10:58:09.683Z (over 1 year ago)
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/inquirer-table-prompt
- Size: 175 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# inquirer-table-prompt [![npm version](https://badge.fury.io/js/inquirer-table-prompt.svg)](https://badge.fury.io/js/inquirer-table-prompt)
> A table-like prompt for [Inquirer.js](https://github.com/SBoudrias/Inquirer.js)
![Screen capture of the table prompt](screen-capture.gif)
## 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.
```js
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