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

Merge branch 'main' of https://github.com/natemoo-re/clack into builder

Bruno Rocha (Aug 23, 2023, 12:54 PM -0300) 56ad3137 65ff05a3

+10 -18
+10 -18
packages/prompts/src/index.ts
··· 174 174 ? { value: Value; label?: string; hint?: string } 175 175 : { value: Value; label: string; hint?: string }; 176 176 177 - export interface SelectOptions<Options extends Option<Value>[], Value> { 177 + export interface SelectOptions<Value> { 178 178 message: string; 179 - options: Options; 179 + options: Option<Value>[]; 180 180 initialValue?: Value; 181 181 maxItems?: number; 182 182 } 183 183 184 - export const select = <Options extends Option<Value>[], Value>( 185 - opts: SelectOptions<Options, Value> 186 - ) => { 184 + export const select = <Value>(opts: SelectOptions<Value>) => { 187 185 const opt = (option: Option<Value>, state: 'inactive' | 'active' | 'selected' | 'cancelled') => { 188 186 const label = option.label ?? String(option.value); 189 187 if (state === 'active') { ··· 253 251 }).prompt() as Promise<Value | symbol>; 254 252 }; 255 253 256 - export const selectKey = <Options extends Option<Value>[], Value extends string>( 257 - opts: SelectOptions<Options, Value> 258 - ) => { 254 + export const selectKey = <Value extends string>(opts: SelectOptions<Value>) => { 259 255 const opt = ( 260 256 option: Option<Value>, 261 257 state: 'inactive' | 'active' | 'selected' | 'cancelled' = 'inactive' ··· 301 297 }).prompt() as Promise<Value | symbol>; 302 298 }; 303 299 304 - export interface MultiSelectOptions<Options extends Option<Value>[], Value> { 300 + export interface MultiSelectOptions<Value> { 305 301 message: string; 306 - options: Options; 302 + options: Option<Value>[]; 307 303 initialValues?: Value[]; 308 304 required?: boolean; 309 305 cursorAt?: Value; 310 306 } 311 - export const multiselect = <Options extends Option<Value>[], Value>( 312 - opts: MultiSelectOptions<Options, Value> 313 - ) => { 307 + export const multiselect = <Value>(opts: MultiSelectOptions<Value>) => { 314 308 const opt = ( 315 309 option: Option<Value>, 316 310 state: 'inactive' | 'active' | 'selected' | 'active-selected' | 'submitted' | 'cancelled' ··· 419 413 }).prompt() as Promise<Value[] | symbol>; 420 414 }; 421 415 422 - export interface GroupMultiSelectOptions<Options extends Option<Value>[], Value> { 416 + export interface GroupMultiSelectOptions<Value> { 423 417 message: string; 424 - options: Record<string, Options>; 418 + options: Record<string, Option<Value>[]>; 425 419 initialValues?: Value[]; 426 420 required?: boolean; 427 421 cursorAt?: Value; 428 422 } 429 - export const groupMultiselect = <Options extends Option<Value>[], Value>( 430 - opts: GroupMultiSelectOptions<Options, Value> 431 - ) => { 423 + export const groupMultiselect = <Value>(opts: GroupMultiSelectOptions<Value>) => { 432 424 const opt = ( 433 425 option: Option<Value>, 434 426 state: