[Bug] multiselect only shows the hint on the first item in the options
skoblenick opened this issue · comments
Ryan Skoblenick commented
Environment
- OS: Ubuntu 22.04.4
- Node Version: 22.2.0
- Package: @clack/prompts
- Package Version: 0.7.0
Describe the bug
The multiselect only shows the hint on the first item in the options, as shown below:
- scenario 1:
◆ Select additional tools.
│ ◼ Prettier (recommended)
│ ◼ ESLint
│ ◻ Stylelint
│ ◻ GitHub Action
└
- scenario 2:
◆ Select additional tools.
│ ◻ Prettier
│ ◼ ESLint
│ ◻ Stylelint
│ ◼ GitHub Action
└
To Reproduce
Basically taken from your examples in this repo; see https://stackblitz.com/edit/node-kwuxhe
Steps to reproduce the behavior:
- run
npm init -y
- run
npm install @clack/prompts --save
- add
"type": "module"
to thepackage.json
- use the code:
#!/usr/bin/env node import * as p from '@clack/prompts'; async function main() { const project = await p.group({ scenario1: () => p.multiselect({ message: 'Scenario 1.', initialValues: ['prettier', 'eslint'], options: [ { value: 'prettier', label: 'Prettier', hint: 'recommended' }, { value: 'eslint', label: 'ESLint', hint: 'recommended' }, { value: 'stylelint', label: 'Stylelint' }, { value: 'gh-action', label: 'GitHub Action' }, ], }), scenario2: () => p.multiselect({ message: 'Scenario 2', initialValues: ['eslint', 'gh-action'], options: [ { value: 'prettier', label: 'Prettier' }, { value: 'eslint', label: 'ESLint', hint: 'recommended' }, { value: 'stylelint', label: 'Stylelint' }, { value: 'gh-action', label: 'GitHub Action', hint: 'recommended' }, ], }), }); } main().catch(console.log);
- run the code with
node ./index.js
Expected behavior
I would expect the output from the prompt to be:
◆ Scenario 1.
│ ◼ Prettier (recommended)
│ ◼ ESLint (recommended)
│ ◻ Stylelint
│ ◻ GitHub Action
└
◆ Scenario 2.
│ ◻ Prettier
│ ◼ ESLint (recommended)
│ ◻ Stylelint
│ ◼ GitHub Action (recommended)
└