Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inquirer "when" got empty "answers" #16

Open
Akiyamka opened this issue Feb 18, 2020 · 0 comments
Open

Inquirer "when" got empty "answers" #16

Akiyamka opened this issue Feb 18, 2020 · 0 comments

Comments

@Akiyamka
Copy link
Contributor

Akiyamka commented Feb 18, 2020

  .ask({
    type: 'confirm',
    name: 'bacon',
    message: 'Do you like bacon?'
  })
  .ask({
    type: 'input',
    name: 'favorite',
    message: 'Bacon lover, what is your favorite type of bacon?',
    when: function(answers) {
      console.log(answers) // BUG: get {}, expected { bacon: true | false }
      return answers.bacon;
    }
  })

Inquirer "when" got empty "answers" because recli run every question as separate inquirer sequence

You can push questions to separate array config.questions and run all questions in one inquirer sequence before tasks

Full example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant