[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.

multiselect: initialValue -> initialValues (#73)

authored by

Nate Moore and committed by
GitHub
(Feb 21, 2023, 9:15 PM -0600) 57df9009 68f5c56f

+11 -5
+6
.changeset/tall-hairs-knock.md
··· 1 + --- 2 + "@clack/core": minor 3 + "@clack/prompts": minor 4 + --- 5 + 6 + **Breaking Change** `multiselect` has renamed `initialValue` to `initialValues`
+1 -1
examples/basic/index.ts
··· 42 42 tools: () => 43 43 p.multiselect({ 44 44 message: 'Select additional tools.', 45 - initialValue: ['prettier', 'eslint'], 45 + initialValues: ['prettier', 'eslint'], 46 46 options: [ 47 47 { value: 'prettier', label: 'Prettier', hint: 'recommended' }, 48 48 { value: 'eslint', label: 'ESLint', hint: 'recommended' },
+2 -2
packages/core/src/prompts/multi-select.ts
··· 2 2 3 3 interface MultiSelectOptions<T extends { value: any }> extends PromptOptions<MultiSelectPrompt<T>> { 4 4 options: T[]; 5 - initialValue?: T['value'][]; 5 + initialValues?: T['value'][]; 6 6 required?: boolean; 7 7 cursorAt?: T['value']; 8 8 } ··· 25 25 super(opts, false); 26 26 27 27 this.options = opts.options; 28 - this.value = [...(opts.initialValue ?? [])]; 28 + this.value = [...(opts.initialValues ?? [])]; 29 29 this.cursor = Math.max( 30 30 this.options.findIndex(({ value }) => value === opts.cursorAt), 31 31 0
+2 -2
packages/prompts/src/index.ts
··· 219 219 export interface MultiSelectOptions<Options extends Option<Value>[], Value extends Primitive> { 220 220 message: string; 221 221 options: Options; 222 - initialValue?: Options[number]['value'][]; 222 + initialValues?: Options[number]['value'][]; 223 223 required?: boolean; 224 224 cursorAt?: Options[number]['value']; 225 225 } ··· 251 251 252 252 return new MultiSelectPrompt({ 253 253 options: opts.options, 254 - initialValue: opts.initialValue, 254 + initialValues: opts.initialValues, 255 255 required: opts.required ?? true, 256 256 cursorAt: opts.cursorAt, 257 257 validate(selected: Value[]) {