Pretty Inquirer
This package is on top of inquirer and makes it easy to use inquirer.
Installation
$ npm i pretty-inquirer
// or
$ yarn add pretty-inquirer
Usage
Please read docs of inquirer before reading this section. Every options specified is defined inside inquirer documentations.
const createQuestions opts = ; const props = ; async ifawait propssingle console; else console;
Pretty inquirer gets user input as you use the props. For example, if the user answers Are you single?
with yes, we only get his/her name after that and will never ask about his/her skills. Otherwise, we ask about his/her skills and never ask about his/her name.
If you use a prop multiple times, the question will be asked only once and will be cached. In the example below, name will be asked only once:
const createQuestions opts = ; const props = ; async ifawait propsname === 'Maryam' console; else console;
If you want to ask name every time you can use askAnswered
option:
const createQuestions opts = ; const props = ; async ifawait propsname === 'Maryam' console; else console;
Which force pretty-inquirer
to ask the same question every time.