Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/breuleux/inquirer-shortcuts
Promise wrapper for inquirer
https://github.com/breuleux/inquirer-shortcuts
Last synced: 9 days ago
JSON representation
Promise wrapper for inquirer
- Host: GitHub
- URL: https://github.com/breuleux/inquirer-shortcuts
- Owner: breuleux
- Created: 2016-01-25T03:02:28.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-10-30T18:04:32.000Z (about 8 years ago)
- Last Synced: 2024-10-18T18:54:16.445Z (28 days ago)
- Language: JavaScript
- Size: 6.84 KB
- Stars: 3
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
inquirer-shortcuts
==================Wraps the [`inquirer`](https://github.com/SBoudrias/Inquirer.js/)
package and adds shortcuts for all question types. This is handy if
you only have one prompt or if you use async/await.## prompt
This method remains unchanged from the `inquirer` package.
```javascript
inquirer = require("inquirer-shortcuts");inquirer.prompt([{type: "input",
name: "animal",
message: "Favorite animal?",
default: "wapiti"}])
.then(results => console.log(results.animal));
```## question
Ask one question.
```javascript
inquirer.question({type: "input",
message: "Favorite animal?",
default: "wapiti"})
.then(animal => console.log(animal));
```## input
```javascript
inquirer.input("Favorite animal?", {default: "wapiti"})
.then(animal => console.log(animal));
```## confirm
```javascript
inquirer.confirm("Is the wapiti your favorite animal?")
.then(answer => console.log(answer));
```## list
```javascript
inquirer.list("Favorite animal?", ["cat", "dog", "wapiti"])
.then(animal => console.log(animal));
```## rawlist
```javascript
inquirer.rawlist("Favorite animal?", ["cat", "dog", "wapiti"])
.then(animal => console.log(animal));
```## expand
```javascript
inquirer.expand("Favorite animal?",
[{key: "c", name: "cat"}
{key: "d", name: "dog"}
{key: "w", name: "wapiti"}])
.then(animal => console.log(animal));
```## checkbox
```javascript
inquirer.checkbox("Favorite animals?", ["cat", "dog", "wapiti"])
.then(animals => console.log(animals));
```## password
```javascript
inquirer.password("Enter password.")
.then(password => console.log("Don't print passwords!"));
```