1
0
mirror of https://github.com/actions/labeler synced 2026-05-10 20:41:02 +02:00
This commit is contained in:
David Kale
2020-09-08 13:25:36 -04:00
parent e4246d2b5b
commit 91fcbb0108
4227 changed files with 416837 additions and 457884 deletions

86
node_modules/prompts/readme.md generated vendored
View File

@@ -33,7 +33,7 @@
* **Promised**: uses promises and `async`/`await`. No callback hell.
* **Flexible**: all prompts are independent and can be used on their own.
* **Testable**: provides a way to submit answers programmatically.
* **Unified**: consistent experience across all prompts.
* **Unified**: consistent experience across all [prompts](#-types).
![split](https://github.com/terkelg/prompts/raw/master/media/split.png)
@@ -78,7 +78,7 @@ const prompts = require('prompts');
### Single Prompt
Prompt with a single prompt object. Returns object with the response.
Prompt with a single prompt object. Returns an object with the response.
```js
const prompts = require('prompts');
@@ -96,7 +96,7 @@ const prompts = require('prompts');
### Prompt Chain
Prompt with a list of prompt objects. Returns object with response.
Prompt with a list of prompt objects. Returns an object with the responses.
Make sure to give each prompt a unique `name` property to prevent overwriting values.
```js
@@ -191,7 +191,7 @@ Return `true` to quit the prompt chain and return all collected responses so far
```js
(async () => {
const questions = [{ ... }];
const onSubmit = (prompt, response) => console.log(`Thanks I got ${response} from ${prompt.name}`);
const onSubmit = (prompt, answer) => console.log(`Thanks I got ${answer} from ${prompt.name}`);
const response = await prompts(questions, { onSubmit });
})();
```
@@ -415,7 +415,7 @@ Type: `Function`
Callback for when the state of the current prompt changes.
The function signature is `(state)` where `state` is an object with a snapshot of the current state.
The state object have two properties `value` and `aborted`. E.g `{ value: 'This is ', aborted: false }`
The state object has two properties `value` and `aborted`. E.g `{ value: 'This is ', aborted: false }`
![split](https://github.com/terkelg/prompts/raw/master/media/split.png)
@@ -423,6 +423,21 @@ The state object have two properties `value` and `aborted`. E.g `{ value: 'This
## Types
* [text](#textmessage-initial-style)
* [password](#passwordmessage-initial)
* [invisible](#invisiblemessage-initial)
* [number](#numbermessage-initial-max-min-style)
* [confirm](#confirmmessage-initial)
* [list](#listmessage-initial)
* [toggle](#togglemessage-initial-active-inactive)
* [select](#selectmessage-choices-initial-hint-warn)
* [multiselect](#multiselectmessage-choices-initial-max-hint-warn)
* [autocompleteMultiselect](#multiselectmessage-choices-initial-max-hint-warn)
* [autocomplete](#autocompletemessage-choices-initial-suggest-limit-style)
* [date](#datemessage-initial-warn)
***
### text(message, [initial], [style])
> Text prompt for free text input.
@@ -448,8 +463,11 @@ Hit <kbd>tab</kbd> to autocomplete to `initial` value when provided.
| format | `function` | Receive user input. The returned value will be added to the response object |
| validate | `function` | Receive user input. Should return `true` if the value is valid, and an error message `String` otherwise. If `false` is returned, a default error message is shown |
| onRender | `function` | On render callback. Keyword `this` refers to the current prompt |
| onState | `function` | On state change callback. Function signature is an `object` with two propetires: `value` and `aborted` |
| onState | `function` | On state change callback. Function signature is an `object` with two properties: `value` and `aborted` |
**↑ back to:** [Prompt types](#-types)
***
### password(message, [initial])
> Password prompt with masked input.
@@ -475,8 +493,11 @@ This prompt is a similar to a prompt of type `'text'` with `style` set to `'pass
| format | `function` | Receive user input. The returned value will be added to the response object |
| validate | `function` | Receive user input. Should return `true` if the value is valid, and an error message `String` otherwise. If `false` is returned, a default error message is shown |
| onRender | `function` | On render callback. Keyword `this` refers to the current prompt |
| onState | `function` | On state change callback. Function signature is an `object` with two propetires: `value` and `aborted` |
| onState | `function` | On state change callback. Function signature is an `object` with two properties: `value` and `aborted` |
**↑ back to:** [Prompt types](#-types)
***
### invisible(message, [initial])
> Prompts user for invisible text input.
@@ -503,8 +524,11 @@ This prompt is a similar to a prompt of type `'text'` with style set to `'invisi
| format | `function` | Receive user input. The returned value will be added to the response object |
| validate | `function` | Receive user input. Should return `true` if the value is valid, and an error message `String` otherwise. If `false` is returned, a default error message is shown |
| onRender | `function` | On render callback. Keyword `this` refers to the current prompt |
| onState | `function` | On state change callback. Function signature is an `object` with two propetires: `value` and `aborted` |
| onState | `function` | On state change callback. Function signature is an `object` with two properties: `value` and `aborted` |
**↑ back to:** [Prompt types](#-types)
***
### number(message, initial, [max], [min], [style])
> Prompts user for number input.
@@ -540,7 +564,11 @@ You can type in numbers and use <kbd>up</kbd>/<kbd>down</kbd> to increase/decrea
| increment | `number` | Increment step when using <kbd>arrow</kbd> keys. Defaults to `1` |
| style | `string` | Render style (`default`, `password`, `invisible`, `emoji`). Defaults to `default` |
| onRender | `function` | On render callback. Keyword `this` refers to the current prompt |
| onState | `function` | On state change callback. Function signature is an `object` with two propetires: `value` and `aborted` |
| onState | `function` | On state change callback. Function signature is an `object` with two properties: `value` and `aborted` |
**↑ back to:** [Prompt types](#-types)
***
### confirm(message, [initial])
> Classic yes/no prompt.
@@ -569,6 +597,10 @@ Hit <kbd>y</kbd> or <kbd>n</kbd> to confirm/reject.
| onRender | `function` | On render callback. Keyword `this` refers to the current prompt |
| onState | `function` | On state change callback. Function signature is an `object` with two properties: `value` and `aborted` |
**↑ back to:** [Prompt types](#-types)
***
### list(message, [initial])
> List prompt that return an array.
@@ -595,8 +627,11 @@ string separated by `separator`.
| format | `function` | Receive user input. The returned value will be added to the response object |
| separator | `string` | String separator. Will trim all white-spaces from start and end of string. Defaults to `','` |
| onRender | `function` | On render callback. Keyword `this` refers to the current prompt |
| onState | `function` | On state change callback. Function signature is an `object` with two propetires: `value` and `aborted` |
| onState | `function` | On state change callback. Function signature is an `object` with two properties: `value` and `aborted` |
**↑ back to:** [Prompt types](#-types)
***
### toggle(message, [initial], [active], [inactive])
> Interactive toggle/switch prompt.
@@ -626,7 +661,11 @@ Use tab or <kbd>arrow keys</kbd>/<kbd>tab</kbd>/<kbd>space</kbd> to switch betwe
| active | `string` | Text for `active` state. Defaults to `'on'` |
| inactive | `string` | Text for `inactive` state. Defaults to `'off'` |
| onRender | `function` | On render callback. Keyword `this` refers to the current prompt |
| onState | `function` | On state change callback. Function signature is an `object` with two propetires: `value` and `aborted` |
| onState | `function` | On state change callback. Function signature is an `object` with two properties: `value` and `aborted` |
**↑ back to:** [Prompt types](#-types)
***
### select(message, choices, [initial], [hint], [warn])
> Interactive select prompt.
@@ -642,7 +681,7 @@ Use <kbd>up</kbd>/<kbd>down</kbd> to navigate. Use <kbd>tab</kbd> to cycle the l
name: 'value',
message: 'Pick a color',
choices: [
{ title: 'Red', value: '#ff0000' },
{ title: 'Red', description: 'This option has a description', value: '#ff0000' },
{ title: 'Green', value: '#00ff00', disabled: true },
{ title: 'Blue', value: '#0000ff' }
],
@@ -658,10 +697,14 @@ Use <kbd>up</kbd>/<kbd>down</kbd> to navigate. Use <kbd>tab</kbd> to cycle the l
| format | `function` | Receive user input. The returned value will be added to the response object |
| hint | `string` | Hint to display to the user |
| warn | `string` | Message to display when selecting a disabled option |
| choices | `Array` | Array of strings or choices objects `[{ title, value, disabled }, ...]`. The choice's index in the array will be used as its value if it is not specified. |
| choices | `Array` | Array of strings or choices objects `[{ title, description, value, disabled }, ...]`. The choice's index in the array will be used as its value if it is not specified. |
| onRender | `function` | On render callback. Keyword `this` refers to the current prompt |
| onState | `function` | On state change callback. Function signature is an `object` with two properties: `value` and `aborted` |
**↑ back to:** [Prompt types](#-types)
***
### multiselect(message, choices, [initial], [max], [hint], [warn])
### autocompleteMultiselect(same)
> Interactive multi-select prompt.
@@ -693,7 +736,9 @@ By default this prompt returns an `array` containing the **values** of the selec
| ----- | :--: | ----------- |
| message | `string` | Prompt message to display |
| format | `function` | Receive user input. The returned value will be added to the response object |
| instructions | `string` or `boolean` | Prompt instructions to display |
| choices | `Array` | Array of strings or choices objects `[{ title, value, disabled }, ...]`. The choice's index in the array will be used as its value if it is not specified. |
| optionsPerPage | `number` | Number of options displayed per page (default: 10) |
| min | `number` | Min select - will display error |
| max | `number` | Max select |
| hint | `string` | Hint to display to the user |
@@ -704,6 +749,9 @@ By default this prompt returns an `array` containing the **values** of the selec
This is one of the few prompts that don't take a initial value.
If you want to predefine selected values, give the choice object an `selected` property of `true`.
**↑ back to:** [Prompt types](#-types)
***
### autocomplete(message, choices, [initial], [suggest], [limit], [style])
> Interactive auto complete prompt.
@@ -742,9 +790,9 @@ You can overwrite how choices are being filtered by passing your own suggest fun
| limit | `number` | Max number of results to show. Defaults to `10` |
| style | `string` | Render style (`default`, `password`, `invisible`, `emoji`). Defaults to `'default'` |
| initial | `string \| number` | Default initial value |
| fallback | `function` | Fallback message when no match is found. Defaults to `initial` value if provided |
| fallback | `string` | Fallback message when no match is found. Defaults to `initial` value if provided |
| onRender | `function` | On render callback. Keyword `this` refers to the current prompt |
| onState | `function` | On state change callback. Function signature is an `object` with two propetires: `value` and `aborted` |
| onState | `function` | On state change callback. Function signature is an `object` with two properties: `value` and `aborted` |
Example on what a `suggest` function might look like:
```js
@@ -752,6 +800,9 @@ const suggestByTitle = (input, choices) =>
Promise.resolve(choices.filter(i => i.title.slice(0, input.length) === input))
```
**↑ back to:** [Prompt types](#-types)
***
### date(message, [initial], [warn])
> Interactive date prompt.
@@ -780,7 +831,7 @@ Use <kbd>left</kbd>/<kbd>right</kbd>/<kbd>tab</kbd> to navigate. Use <kbd>up</kb
| mask | `string` | The format mask of the date. See below for more information.<br />Default: `YYYY-MM-DD HH:mm:ss` |
| validate | `function` | Receive user input. Should return `true` if the value is valid, and an error message `String` otherwise. If `false` is returned, a default error message is shown |
| onRender | `function` | On render callback. Keyword `this` refers to the current prompt |
| onState | `function` | On state change callback. Function signature is an `object` with two propetires: `value` and `aborted` |
| onState | `function` | On state change callback. Function signature is an `object` with two properties: `value` and `aborted` |
Default locales:
@@ -808,6 +859,9 @@ Default locales:
![split](https://github.com/terkelg/prompts/raw/master/media/split.png)
**↑ back to:** [Prompt types](#-types)
***
## Credit
Many of the prompts are based on the work of [derhuerst](https://github.com/derhuerst).