@topcli/prompts 2.4.1 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,275 +1,348 @@
1
- <div align="center">
2
- <img src="./public/banner.png" alt="@topcli/prompts">
3
-
4
- ![version](https://img.shields.io/badge/dynamic/json.svg?style=for-the-badge&url=https://raw.githubusercontent.com/TopCli/prompts/main/package.json&query=$.version&label=Version)
5
- [![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg?style=for-the-badge)](https://github.com/TopCli/prompts/commit-activity)
6
- [![isc](https://img.shields.io/badge/License-ISC-blue.svg?style=for-the-badge)](https://github.com/TopCli/prompts/blob/main/LICENSE)
7
- [![scorecard](https://api.securityscorecards.dev/projects/github.com/TopCli/prompts/badge?style=for-the-badge)](https://ossf.github.io/scorecard-visualizer/#/projects/github.com/TopCli/prompts)
8
- ![build](https://img.shields.io/github/actions/workflow/status/TopCli/prompts/node.js.yml?style=for-the-badge)
9
-
10
- <img src="./public/topcli.gif" alt="demo">
11
- </div>
12
-
13
- ## Requirements
14
- - [Node.js](https://nodejs.org/en/) v20 or higher
15
-
16
- ## Getting Started
17
-
18
- This package is available in the Node Package Repository and can be easily installed with [npm](https://docs.npmjs.com/getting-started/what-is-npm) or [yarn](https://yarnpkg.com).
19
-
20
- ```bash
21
- $ npm i @topcli/prompts
22
- # or
23
- $ yarn add @topcli/prompts
24
- ```
25
-
26
- ## Usage exemple
27
-
28
- You can locally run `node ./demo.js`
29
-
30
- ```js
31
- import { question, confirm, select, multiselect } from "@topcli/prompts";
32
-
33
- const kTestRunner = ["node", "tap", "tape", "vitest", "mocha", "ava"];
34
-
35
- const name = await question("Project name ?", { defaultValue: "foo" });
36
- const runner = await select("Choose a test runner", { choices: kTestRunner, maxVisible: 5 });
37
- const isCLI = await confirm("Your project is a CLI ?", { initial: true });
38
- const os = await multiselect("Choose OS", {
39
- choices: ["linux", "mac", "windows"],
40
- preSelectedChoices: ["linux"]
41
- });
42
-
43
- console.log(name, runner, isCLI, os);
44
- ```
45
-
46
- ## API
47
-
48
- ### `question()`
49
-
50
- ```ts
51
- question(message: string, options?: PromptOptions): Promise<string>
52
- ```
53
-
54
- Simple prompt, similar to `rl.question()` with an improved UI.
55
-
56
- Use `options.defaultValue` to set a default value.
57
-
58
- Use `options.secure` if you need to hide both input and answer. You can provide either a **boolean** or an **object** which allows to configure a `placeholder` such as `*`.
59
-
60
- Use `options.signal` to set an `AbortSignal` (throws a [AbortError](#aborterror)).
61
-
62
- Use `options.validators` to handle user input.
63
-
64
- Use `options.skip` to skip prompt. It will return `options.defaultValue` if given, `""` otherwise.
65
-
66
- **Example**
67
-
68
- ```js
69
- const packageName = await question('Package name', {
70
- validators: [
71
- {
72
- validate: (value) => {
73
- if (fs.existsSync(path.join(process.cwd(), value))) {
74
- return `Folder ${value} already exists`;
75
- }
76
- }
77
- }
78
- ]
79
- });
80
- ```
81
-
82
- **This package provide some validators for common usage**
83
-
84
- - required
85
-
86
- ```js
87
- import { question, required } from "@topcli/prompts";
88
-
89
- const name = await question("What's your name ?", {
90
- validators: [required()]
91
- });
92
- ```
93
-
94
- ### `select()`
95
-
96
- ```ts
97
- select<T extends string>(message: string, options: SelectOptions<T>): Promise<T>
98
- ```
99
-
100
- Scrollable select depending `maxVisible` (default `8`).
101
-
102
- Use `options.ignoreValues` to skip result render & clear lines after a selected one.
103
-
104
- Use `options.validators` to handle user input.
105
-
106
- Use `options.autocomplete` to allow filtered choices. This can be useful for a large list of choices.
107
-
108
- Use `options.caseSensitive` to make autocomplete filters case sensitive. Default `false`
109
-
110
- Use `options.signal` to set an `AbortSignal` (throws a [AbortError](#aborterror)).
111
-
112
- Use `options.skip` to skip prompt. It will return the first choice.
113
-
114
- ### `multiselect()`
115
-
116
- ```ts
117
- multiselect<T extends string>(message: string, options: MultiselectOptions<T>): Promise<T[]>
118
- ```
119
-
120
- Scrollable multiselect depending `options.maxVisible` (default `8`).<br>
121
- Use `options.preSelectedChoices` to pre-select choices.
122
-
123
- Use `options.validators` to handle user input.
124
-
125
- Use `options.showHint: false` to disable hint (this option is truthy by default).
126
-
127
- Use `options.autocomplete` to allow filtered choices. This can be useful for a large list of choices.
128
-
129
- Use `options.caseSensitive` to make autocomplete filters case sensitive. Default `false`.
130
-
131
- Use `options.signal` to set an `AbortSignal` (throws a [AbortError](#aborterror)).
132
-
133
- Use `options.skip` to skip prompt. It will return `options.preSelectedChoices` if given, `[]` otherwise.
134
-
135
- ### `confirm()`
136
-
137
- ```ts
138
- confirm(message: string, options?: ConfirmOptions): Promise<boolean>
139
- ```
140
-
141
- Boolean prompt, default to `options.initial` (`false`).
142
-
143
- > [!TIP]
144
- > You can answer pressing <kbd>Y</kbd> or <kbd>N</kbd>
145
-
146
- Use `options.signal` to set an `AbortSignal` (throws a [AbortError](#aborterror)).
147
-
148
- Use `options.skip` to skip prompt. It will return `options.initial` (`false` by default)
149
-
150
- ### `PromptAgent`
151
-
152
- The `PromptAgent` class allows to programmatically set the next answers for any prompt function, this can be useful for testing.
153
-
154
- ```ts
155
- const agent = PromptAgent.agent();
156
- agent.nextAnswer("John");
157
-
158
- const input = await question("What's your name?");
159
- assert.equal(input, "John");
160
- ```
161
-
162
- > [!WARNING]
163
- > Answers set with `PromptAgent` will **bypass** any logical & validation rules.
164
- > Examples:
165
- > - When using `question()`, `validators` functions will not be executed.
166
- > - When using `select()`, the answer can be different from the available choices.
167
- > - When using `confirm()`, the answer can be any type other than boolean.
168
- > - etc<br>
169
- > **Use with caution**
170
-
171
- ## Errors
172
-
173
- ### `AbortError`
174
-
175
- ```ts
176
- export class AbortError extends Error {
177
- constructor(message: string) {
178
- super(message);
179
- this.name = "AbortError";
180
- }
181
- }
182
- ```
183
-
184
- ## Interfaces
185
-
186
- ```ts
187
- type Stdin = NodeJS.ReadStream & {
188
- fd: 0;
189
- };
190
-
191
- type Stdout = NodeJS.WriteStream & {
192
- fd: 1;
193
- }
194
-
195
- export interface AbstractPromptOptions {
196
- stdin?: Stdin;
197
- stdout?: Stdout;
198
- message: string;
199
- skip?: boolean;
200
- signal?: AbortSignal;
201
- }
202
-
203
- export interface PromptValidator<T extends string | string[]> {
204
- validate: (input: T) => boolean;
205
- }
206
-
207
- export interface QuestionOptions extends SharedOptions {
208
- defaultValue?: string;
209
- validators?: PromptValidator<string>[];
210
- secure?: boolean;
211
- }
212
-
213
- export interface Choice<T = any> {
214
- value: T;
215
- label: string;
216
- description?: string;
217
- }
218
-
219
- export interface SelectOptions<T extends string> extends AbstractPromptOptions {
220
- choices: (Choice<T> | T)[];
221
- maxVisible?: number;
222
- ignoreValues?: (T | number | boolean)[];
223
- validators?: PromptValidator<string>[];
224
- autocomplete?: boolean;
225
- caseSensitive?: boolean;
226
- }
227
-
228
- export interface MultiselectOptions<T extends string> extends AbstractPromptOptions {
229
- choices: (Choice<T> | T)[];
230
- maxVisible?: number;
231
- preSelectedChoices?: (Choice<T> | T)[];
232
- validators?: PromptValidator<string[]>[];
233
- autocomplete?: boolean;
234
- caseSensitive?: boolean;
235
- showHint?: boolean;
236
- }
237
-
238
- export interface ConfirmOptions extends AbstractPromptOptions {
239
- initial?: boolean;
240
- }
241
- ```
242
-
243
- ## Contributing
244
-
245
- Please read [CONTRIBUTING.md](./CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.
246
-
247
- Open an issue if you want to provide feedback such as bug reports or enchancements.
248
-
249
- ## Contributors
250
-
251
- <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
252
- <!-- prettier-ignore-start -->
253
- <!-- markdownlint-disable -->
254
- <table>
255
- <tbody>
256
- <tr>
257
- <td align="center" valign="top" width="14.28%"><a href="https://github.com/PierreDemailly"><img src="https://avatars.githubusercontent.com/u/39910767?v=4?s=100" width="100px;" alt="PierreDemailly"/><br /><sub><b>PierreDemailly</b></sub></a><br /><a href="https://github.com/TopCli/prompts/commits?author=PierreDemailly" title="Code">💻</a> <a href="https://github.com/TopCli/prompts/commits?author=PierreDemailly" title="Tests">⚠️</a></td>
258
- <td align="center" valign="top" width="14.28%"><a href="https://www.linkedin.com/in/thomas-gentilhomme/"><img src="https://avatars.githubusercontent.com/u/4438263?v=4?s=100" width="100px;" alt="Gentilhomme"/><br /><sub><b>Gentilhomme</b></sub></a><br /><a href="https://github.com/TopCli/prompts/pulls?q=is%3Apr+reviewed-by%3Afraxken" title="Reviewed Pull Requests">👀</a> <a href="https://github.com/TopCli/prompts/commits?author=fraxken" title="Code">💻</a> <a href="https://github.com/TopCli/prompts/commits?author=fraxken" title="Documentation">📖</a></td>
259
- <td align="center" valign="top" width="14.28%"><a href="http://tonygo.dev"><img src="https://avatars0.githubusercontent.com/u/22824417?v=4?s=100" width="100px;" alt="Tony Gorez"/><br /><sub><b>Tony Gorez</b></sub></a><br /><a href="https://github.com/TopCli/prompts/pulls?q=is%3Apr+reviewed-by%3Atony-go" title="Reviewed Pull Requests">👀</a></td>
260
- <td align="center" valign="top" width="14.28%"><a href="http://sofiand.github.io/portfolio-client/"><img src="https://avatars.githubusercontent.com/u/39944043?v=4?s=100" width="100px;" alt="Yefis"/><br /><sub><b>Yefis</b></sub></a><br /><a href="https://github.com/TopCli/prompts/commits?author=SofianD" title="Code">💻</a> <a href="https://github.com/TopCli/prompts/commits?author=SofianD" title="Documentation">📖</a></td>
261
- <td align="center" valign="top" width="14.28%"><a href="http://justie.dev"><img src="https://avatars.githubusercontent.com/u/7118300?v=4?s=100" width="100px;" alt="Ben"/><br /><sub><b>Ben</b></sub></a><br /><a href="https://github.com/TopCli/prompts/commits?author=JUSTIVE" title="Documentation">📖</a> <a href="#maintenance-JUSTIVE" title="Maintenance">🚧</a></td>
262
- <td align="center" valign="top" width="14.28%"><a href="https://github.com/ncukondo"><img src="https://avatars.githubusercontent.com/u/17022138?v=4?s=100" width="100px;" alt="Takeshi Kondo"/><br /><sub><b>Takeshi Kondo</b></sub></a><br /><a href="#maintenance-ncukondo" title="Maintenance">🚧</a></td>
263
- <td align="center" valign="top" width="14.28%"><a href="https://github.com/FredGuiou"><img src="https://avatars.githubusercontent.com/u/99122562?v=4?s=100" width="100px;" alt="FredGuiou"/><br /><sub><b>FredGuiou</b></sub></a><br /><a href="https://github.com/TopCli/prompts/commits?author=FredGuiou" title="Code">💻</a> <a href="https://github.com/TopCli/prompts/commits?author=FredGuiou" title="Tests">⚠️</a> <a href="https://github.com/TopCli/prompts/commits?author=FredGuiou" title="Documentation">📖</a></td>
264
- </tr>
265
- <tr>
266
- <td align="center" valign="top" width="14.28%"><a href="https://github.com/noxify"><img src="https://avatars.githubusercontent.com/u/521777?v=4?s=100" width="100px;" alt="Marcus Reinhardt"/><br /><sub><b>Marcus Reinhardt</b></sub></a><br /><a href="https://github.com/TopCli/prompts/commits?author=noxify" title="Code">💻</a> <a href="https://github.com/TopCli/prompts/commits?author=noxify" title="Tests">⚠️</a> <a href="https://github.com/TopCli/prompts/commits?author=noxify" title="Documentation">📖</a></td>
267
- <td align="center" valign="top" width="14.28%"><a href="https://github.com/ItsHarper"><img src="https://avatars.githubusercontent.com/u/10224994?v=4?s=100" width="100px;" alt="Harper Andrews"/><br /><sub><b>Harper Andrews</b></sub></a><br /><a href="https://github.com/TopCli/prompts/commits?author=ItsHarper" title="Documentation">📖</a></td>
268
- </tr>
269
- </tbody>
270
- </table>
271
-
272
- <!-- markdownlint-restore -->
273
- <!-- prettier-ignore-end -->
274
-
275
- <!-- ALL-CONTRIBUTORS-LIST:END -->
1
+ <div align="center">
2
+ <img src="./public/banner.png" alt="@topcli/prompts">
3
+
4
+ ![version](https://img.shields.io/badge/dynamic/json.svg?style=for-the-badge&url=https://raw.githubusercontent.com/TopCli/prompts/main/package.json&query=$.version&label=Version)
5
+ [![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg?style=for-the-badge)](https://github.com/TopCli/prompts/commit-activity)
6
+ [![isc](https://img.shields.io/badge/License-ISC-blue.svg?style=for-the-badge)](https://github.com/TopCli/prompts/blob/main/LICENSE)
7
+ [![scorecard](https://api.securityscorecards.dev/projects/github.com/TopCli/prompts/badge?style=for-the-badge)](https://ossf.github.io/scorecard-visualizer/#/projects/github.com/TopCli/prompts)
8
+ ![build](https://img.shields.io/github/actions/workflow/status/TopCli/prompts/node.js.yml?style=for-the-badge)
9
+
10
+ <img src="./public/topcli.gif" alt="demo">
11
+ </div>
12
+
13
+ ## Requirements
14
+ - [Node.js](https://nodejs.org/en/) v22 or higher
15
+
16
+ ## Getting Started
17
+
18
+ This package is available in the Node Package Repository and can be easily installed with [npm](https://docs.npmjs.com/getting-started/what-is-npm) or [yarn](https://yarnpkg.com).
19
+
20
+ ```bash
21
+ $ npm i @topcli/prompts
22
+ # or
23
+ $ yarn add @topcli/prompts
24
+ ```
25
+
26
+ ## Usage exemple
27
+
28
+ You can locally run `node ./demo.js`
29
+
30
+ ```js
31
+ import { question, confirm, select, multiselect } from "@topcli/prompts";
32
+
33
+ const kTestRunner = ["node", "tap", "tape", "vitest", "mocha", "ava"];
34
+
35
+ const name = await question("Project name ?", { defaultValue: "foo" });
36
+ const runner = await select("Choose a test runner", { choices: kTestRunner, maxVisible: 5 });
37
+ const isCLI = await confirm("Your project is a CLI ?", { initial: true });
38
+ const os = await multiselect("Choose OS", {
39
+ choices: ["linux", "mac", "windows"],
40
+ preSelectedChoices: ["linux"]
41
+ });
42
+
43
+ console.log(name, runner, isCLI, os);
44
+ ```
45
+
46
+ ## API
47
+
48
+ ### `question()`
49
+
50
+ ```ts
51
+ question<T = string>(message: string, options?: QuestionOptions<T>): Promise<T>
52
+ ```
53
+
54
+ Simple prompt, similar to `rl.question()` with an improved UI.
55
+
56
+ Use `options.defaultValue` to set a default value.
57
+
58
+ Use `options.secure` if you need to hide both input and answer. You can provide either a **boolean** or an **object** which allows to configure a `placeholder` such as `*`.
59
+
60
+ Use `options.signal` to set an `AbortSignal` (throws a [AbortError](#aborterror)).
61
+
62
+ Use `options.validators` to validate user input and re-prompt on failure.
63
+
64
+ Use `options.transformer` to parse and validate user input in a single step, returning a typed value. **Mutually exclusive with `validators`.**
65
+
66
+ Use `options.skip` to skip prompt. It will return `options.defaultValue` if given, `""` otherwise.
67
+
68
+ **Validators examples**
69
+
70
+ ```js
71
+ const packageName = await question('Package name', {
72
+ validators: [
73
+ {
74
+ validate: (value) => {
75
+ if (fs.existsSync(path.join(process.cwd(), value))) {
76
+ return `Folder ${value} already exists`;
77
+ }
78
+ }
79
+ }
80
+ ]
81
+ });
82
+ ```
83
+
84
+ Validators can also be async, for example to validate against an API:
85
+
86
+ ```js
87
+ const userId = await question('User ID', {
88
+ validators: [
89
+ {
90
+ validate: async(userId) => {
91
+ const res = await fetch(`https://api.com/users/${userId}`);
92
+ if (!res.ok) {
93
+ return {
94
+ isValid: false,
95
+ error: `User '${userId}' not found`
96
+ }
97
+ }
98
+ }
99
+ }
100
+ ]
101
+ });
102
+ ```
103
+
104
+ **Transformers examples**
105
+
106
+ ```js
107
+ import { question, transformers } from "@topcli/prompts";
108
+
109
+ const port = await question("Port", { transformer: transformers.number() });
110
+ ```
111
+
112
+ Custom transformer:
113
+
114
+ ```js
115
+ const date = await question("Choose date (YYYY-MM-DD)", {
116
+ transformer: {
117
+ transform: (input) => {
118
+ const date = new Date(input);
119
+
120
+ if (isNaN(date.getTime())) {
121
+ return { isValid: false, error: "invalid date" };
122
+ }
123
+
124
+ return { isValid: true, transformed: date };
125
+ }
126
+ }
127
+ });
128
+ ```
129
+
130
+ **Built-in validators**
131
+
132
+ - `validators.required()` : rejects empty input
133
+
134
+ ```js
135
+ import { question, validators } from "@topcli/prompts";
136
+
137
+ const name = await question("What's your name ?", {
138
+ validators: [validators.required()]
139
+ });
140
+ ```
141
+
142
+ **Built-in transformers**
143
+
144
+ - `transformers.number()`: parses input as a number, rejects non-numeric and empty strings
145
+ - `transformers.integer()`: parses input as an integer, rejects floats, non-numeric and empty strings
146
+ - `transformers.url()`: parses input as a `URL` object, rejects invalid URLs
147
+
148
+ ```js
149
+ import { question, transformers } from "@topcli/prompts";
150
+
151
+ const count = await question("Count", { transformer: transformers.integer() });
152
+ const url = await question("Url", { transformer: transformers.url() });
153
+ ```
154
+
155
+ ### `select()`
156
+
157
+ ```ts
158
+ select<T extends string>(message: string, options: SelectOptions<T>): Promise<T>
159
+ ```
160
+
161
+ Scrollable select depending `maxVisible` (default `8`).
162
+
163
+ Use `options.ignoreValues` to skip result render & clear lines after a selected one.
164
+
165
+ Use `options.validators` to handle user input.
166
+
167
+ Use `options.autocomplete` to allow filtered choices. This can be useful for a large list of choices.
168
+
169
+ Use `options.caseSensitive` to make autocomplete filters case sensitive. Default `false`
170
+
171
+ Use `options.signal` to set an `AbortSignal` (throws a [AbortError](#aborterror)).
172
+
173
+ Use `options.skip` to skip prompt. It will return the first choice.
174
+
175
+ ### `multiselect()`
176
+
177
+ ```ts
178
+ multiselect<T extends string>(message: string, options: MultiselectOptions<T>): Promise<T[]>
179
+ ```
180
+
181
+ Scrollable multiselect depending `options.maxVisible` (default `8`).<br>
182
+ Use `options.preSelectedChoices` to pre-select choices.
183
+
184
+ Use `options.validators` to handle user input.
185
+
186
+ Use `options.showHint: false` to disable hint (this option is truthy by default).
187
+
188
+ Use `options.autocomplete` to allow filtered choices. This can be useful for a large list of choices.
189
+
190
+ Use `options.caseSensitive` to make autocomplete filters case sensitive. Default `false`.
191
+
192
+ Use `options.signal` to set an `AbortSignal` (throws a [AbortError](#aborterror)).
193
+
194
+ Use `options.skip` to skip prompt. It will return `options.preSelectedChoices` if given, `[]` otherwise.
195
+
196
+ ### `confirm()`
197
+
198
+ ```ts
199
+ confirm(message: string, options?: ConfirmOptions): Promise<boolean>
200
+ ```
201
+
202
+ Boolean prompt, default to `options.initial` (`false`).
203
+
204
+ > [!TIP]
205
+ > You can answer pressing <kbd>Y</kbd> or <kbd>N</kbd>
206
+
207
+ Use `options.signal` to set an `AbortSignal` (throws a [AbortError](#aborterror)).
208
+
209
+ Use `options.skip` to skip prompt. It will return `options.initial` (`false` by default)
210
+
211
+ ### `PromptAgent`
212
+
213
+ The `PromptAgent` class allows to programmatically set the next answers for any prompt function, this can be useful for testing.
214
+
215
+ ```ts
216
+ const agent = PromptAgent.agent();
217
+ agent.nextAnswer("John");
218
+
219
+ const input = await question("What's your name?");
220
+ assert.equal(input, "John");
221
+ ```
222
+
223
+ > [!WARNING]
224
+ > Answers set with `PromptAgent` will **bypass** any logical & validation rules.
225
+ > Examples:
226
+ > - When using `question()`, `validators` functions will not be executed.
227
+ > - When using `select()`, the answer can be different from the available choices.
228
+ > - When using `confirm()`, the answer can be any type other than boolean.
229
+ > - etc<br>
230
+ > **Use with caution**
231
+
232
+ ## Errors
233
+
234
+ ### `AbortError`
235
+
236
+ ```ts
237
+ export class AbortError extends Error {
238
+ constructor(message: string) {
239
+ super(message);
240
+ this.name = "AbortError";
241
+ }
242
+ }
243
+ ```
244
+
245
+ ## Interfaces
246
+
247
+ ```ts
248
+ type Stdin = NodeJS.ReadStream & {
249
+ fd: 0;
250
+ };
251
+
252
+ type Stdout = NodeJS.WriteStream & {
253
+ fd: 1;
254
+ }
255
+
256
+ export interface AbstractPromptOptions {
257
+ stdin?: Stdin;
258
+ stdout?: Stdout;
259
+ message: string;
260
+ skip?: boolean;
261
+ signal?: AbortSignal;
262
+ }
263
+
264
+ export interface PromptValidator<T extends string | string[]> {
265
+ validate: (input: T) => ValidationResponse | Promise<ValidationResponse>;
266
+ }
267
+
268
+ export interface PromptTransformer<T> {
269
+ transform: (input: string) => TransformationResponse<T> | Promise<TransformationResponse<T>>;
270
+ }
271
+
272
+ export type ValidTransformationResponse<T> = {
273
+ isValid: true;
274
+ transformed: T;
275
+ };
276
+
277
+ export type TransformationResponse<T> = InvalidResponse | ValidTransformationResponse<T>;
278
+
279
+ export interface QuestionOptions<T = string> extends AbstractPromptOptions {
280
+ defaultValue?: string;
281
+ validators?: PromptValidator<string>[];
282
+ transformer?: PromptTransformer<T>;
283
+ secure?: boolean | { placeholder: string };
284
+ }
285
+
286
+ export interface Choice<T = any> {
287
+ value: T;
288
+ label: string;
289
+ description?: string;
290
+ }
291
+
292
+ export interface SelectOptions<T extends string> extends AbstractPromptOptions {
293
+ choices: (Choice<T> | T)[];
294
+ maxVisible?: number;
295
+ ignoreValues?: (T | number | boolean)[];
296
+ validators?: PromptValidator<string>[];
297
+ autocomplete?: boolean;
298
+ caseSensitive?: boolean;
299
+ }
300
+
301
+ export interface MultiselectOptions<T extends string> extends AbstractPromptOptions {
302
+ choices: (Choice<T> | T)[];
303
+ maxVisible?: number;
304
+ preSelectedChoices?: (Choice<T> | T)[];
305
+ validators?: PromptValidator<string[]>[];
306
+ autocomplete?: boolean;
307
+ caseSensitive?: boolean;
308
+ showHint?: boolean;
309
+ }
310
+
311
+ export interface ConfirmOptions extends AbstractPromptOptions {
312
+ initial?: boolean;
313
+ }
314
+ ```
315
+
316
+ ## Contributing
317
+
318
+ Please read [CONTRIBUTING.md](./CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.
319
+
320
+ Open an issue if you want to provide feedback such as bug reports or enchancements.
321
+
322
+ ## Contributors
323
+
324
+ <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
325
+ <!-- prettier-ignore-start -->
326
+ <!-- markdownlint-disable -->
327
+ <table>
328
+ <tbody>
329
+ <tr>
330
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/PierreDemailly"><img src="https://avatars.githubusercontent.com/u/39910767?v=4?s=100" width="100px;" alt="PierreDemailly"/><br /><sub><b>PierreDemailly</b></sub></a><br /><a href="https://github.com/TopCli/prompts/commits?author=PierreDemailly" title="Code">💻</a> <a href="https://github.com/TopCli/prompts/commits?author=PierreDemailly" title="Tests">⚠️</a></td>
331
+ <td align="center" valign="top" width="14.28%"><a href="https://www.linkedin.com/in/thomas-gentilhomme/"><img src="https://avatars.githubusercontent.com/u/4438263?v=4?s=100" width="100px;" alt="Gentilhomme"/><br /><sub><b>Gentilhomme</b></sub></a><br /><a href="https://github.com/TopCli/prompts/pulls?q=is%3Apr+reviewed-by%3Afraxken" title="Reviewed Pull Requests">👀</a> <a href="https://github.com/TopCli/prompts/commits?author=fraxken" title="Code">💻</a> <a href="https://github.com/TopCli/prompts/commits?author=fraxken" title="Documentation">📖</a></td>
332
+ <td align="center" valign="top" width="14.28%"><a href="http://tonygo.dev"><img src="https://avatars0.githubusercontent.com/u/22824417?v=4?s=100" width="100px;" alt="Tony Gorez"/><br /><sub><b>Tony Gorez</b></sub></a><br /><a href="https://github.com/TopCli/prompts/pulls?q=is%3Apr+reviewed-by%3Atony-go" title="Reviewed Pull Requests">👀</a></td>
333
+ <td align="center" valign="top" width="14.28%"><a href="http://sofiand.github.io/portfolio-client/"><img src="https://avatars.githubusercontent.com/u/39944043?v=4?s=100" width="100px;" alt="Yefis"/><br /><sub><b>Yefis</b></sub></a><br /><a href="https://github.com/TopCli/prompts/commits?author=SofianD" title="Code">💻</a> <a href="https://github.com/TopCli/prompts/commits?author=SofianD" title="Documentation">📖</a></td>
334
+ <td align="center" valign="top" width="14.28%"><a href="http://justie.dev"><img src="https://avatars.githubusercontent.com/u/7118300?v=4?s=100" width="100px;" alt="Ben"/><br /><sub><b>Ben</b></sub></a><br /><a href="https://github.com/TopCli/prompts/commits?author=JUSTIVE" title="Documentation">📖</a> <a href="#maintenance-JUSTIVE" title="Maintenance">🚧</a></td>
335
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/ncukondo"><img src="https://avatars.githubusercontent.com/u/17022138?v=4?s=100" width="100px;" alt="Takeshi Kondo"/><br /><sub><b>Takeshi Kondo</b></sub></a><br /><a href="#maintenance-ncukondo" title="Maintenance">🚧</a></td>
336
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/FredGuiou"><img src="https://avatars.githubusercontent.com/u/99122562?v=4?s=100" width="100px;" alt="FredGuiou"/><br /><sub><b>FredGuiou</b></sub></a><br /><a href="https://github.com/TopCli/prompts/commits?author=FredGuiou" title="Code">💻</a> <a href="https://github.com/TopCli/prompts/commits?author=FredGuiou" title="Tests">⚠️</a> <a href="https://github.com/TopCli/prompts/commits?author=FredGuiou" title="Documentation">📖</a></td>
337
+ </tr>
338
+ <tr>
339
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/noxify"><img src="https://avatars.githubusercontent.com/u/521777?v=4?s=100" width="100px;" alt="Marcus Reinhardt"/><br /><sub><b>Marcus Reinhardt</b></sub></a><br /><a href="https://github.com/TopCli/prompts/commits?author=noxify" title="Code">💻</a> <a href="https://github.com/TopCli/prompts/commits?author=noxify" title="Tests">⚠️</a> <a href="https://github.com/TopCli/prompts/commits?author=noxify" title="Documentation">📖</a></td>
340
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/ItsHarper"><img src="https://avatars.githubusercontent.com/u/10224994?v=4?s=100" width="100px;" alt="Harper Andrews"/><br /><sub><b>Harper Andrews</b></sub></a><br /><a href="https://github.com/TopCli/prompts/commits?author=ItsHarper" title="Documentation">📖</a></td>
341
+ </tr>
342
+ </tbody>
343
+ </table>
344
+
345
+ <!-- markdownlint-restore -->
346
+ <!-- prettier-ignore-end -->
347
+
348
+ <!-- ALL-CONTRIBUTORS-LIST:END -->