[READ-ONLY] Mirror of https://github.com/bombshell-dev/clack. Effortlessly build beautiful command-line apps bomb.sh/docs/clack/basics/getting-started/
cli command-line command-line-app node prompt prompts
5

Configure Feed

Select the types of activity you want to include in your feed.

docs(@clack/prompts): add builder

Bruno Rocha (Aug 11, 2023, 11:18 AM -0300) 1a7738a9 6009a969

+29
+29
packages/prompts/README.md
··· 156 156 157 157 console.log(group.name, group.age, group.color); 158 158 ``` 159 + 160 + ### Building 161 + 162 + Just like `group`, but on `builder` way, so you can choose which one fits better. 163 + 164 + ```js 165 + import * as p from '@clack/prompts'; 166 + 167 + const results = await p 168 + .builder() 169 + .add('name', () => p.text({ message: 'What is your name?' })) 170 + .add('age', () => p.text({ message: 'What is your age?' })) 171 + .add('color', ({ results }) => 172 + p.multiselect({ 173 + message: `What is your favorite color ${results.name}?`, 174 + options: [ 175 + { value: 'red', label: 'Red' }, 176 + { value: 'green', label: 'Green' }, 177 + { value: 'blue', label: 'Blue' } 178 + ] 179 + }) 180 + ) 181 + .onCancel(() => { 182 + p.cancel('Builder canceled'); 183 + process.exit(0); 184 + }) 185 + .run(); 186 + console.log(results.name, results.age, results.color); 187 + ```