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

Feature request: Option to display not-asked (not-activated) questions #1076

Open
GHNewbiee opened this issue Jan 2, 2022 · 0 comments
Open

Comments

@GHNewbiee
Copy link

The case
A wish to display questions (for reference) which are not asked through when property.

The problem
when property just hides the question when its value is false.

Potential solution

  • A new property, or
  • an extra parameter to when property function

which will declare if a not-asked (not-activated) question should be displayed or not.

Example

import inquirer from "inquirer";

inquirer
  .prompt([
    {
      type: 'confirm',
      name: 'fruit',
      message: 'Is it a fruit?',
      default: true
    },
    {
      type: 'confirm',
      name: 'sweet',
      message: 'Is it sweet?',
      default: true,
      when: function (answers, status) {
        status.activated = answers.fruit ? false : true;
        status.displayed = true;
        return status; 
      },
    },
    {
      type: 'confirm',
      name: 'example',
      message: 'Is it a good example?',
      default: true,
    }
  ])
  .then(() => {
    ...
  })
? Is it a fruit? Yes
? Is it sweet? Yes (# default value and, for example, in very light colour to imply that it's not activated)
? is it a good example? Y/n
...

Tia

@GHNewbiee GHNewbiee changed the title Feature request: A not-asked Question to be able to be displayed Feature request: A not-asked (not-activated) question to be able to be displayed Jan 2, 2022
@GHNewbiee GHNewbiee changed the title Feature request: A not-asked (not-activated) question to be able to be displayed Feature request: Option to display not-asked (not-activated) questions Jan 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants