gitea push

This commit is contained in:
2026-05-09 12:19:29 -06:00
parent 06113c95b8
commit 429461e985
1481 changed files with 74306 additions and 52475 deletions
+107 -2
View File
@@ -11,7 +11,7 @@ Effortlessly build beautiful command-line apps 🪄 [Try the demo](https://stack
- 🤏 80% smaller than other options
- 💎 Beautiful, minimal UI
- ✅ Simple API
- 🧱 Comes with `text`, `confirm`, `select`, `multiselect`, and `spinner` components
- 🧱 Comes with `text`, `password`, `confirm`, `date`, `select`, `autocomplete`, `selectKey`, `multiselect`, `path`, and `spinner` components
## Basics
@@ -63,6 +63,22 @@ const meaning = await text({
});
```
### Password
The password component behaves like `text`, but masks the input as the user types.
```js
import { password } from '@clack/prompts';
const secret = await password({
message: 'Set a password.',
mask: '*',
validate(value) {
if (!value || value.length < 8) return 'Password must be at least 8 characters.';
},
});
```
### Confirm
The confirm component accepts a yes or no answer. The result is a boolean value of `true` or `false`.
@@ -75,6 +91,21 @@ const shouldContinue = await confirm({
});
```
### Date
The date component accepts a calendar date and returns a `Date` value.
```js
import { date } from '@clack/prompts';
const dueDate = await date({
message: 'Pick a due date.',
format: 'YMD',
minDate: new Date(Date.UTC(2026, 0, 1)),
maxDate: new Date(Date.UTC(2026, 11, 31)),
});
```
### Select
The select component allows a user to choose one value from a list of options. The result is the `value` prop of a given option.
@@ -92,6 +123,42 @@ const projectType = await select({
});
```
### Autocomplete
The autocomplete component lets a user filter a list by typing, then choose one option from the matching results. By default, matching uses each option's `label`, `hint`, and `value`. The result is the selected option's `value`.
```js
import { autocomplete } from '@clack/prompts';
const framework = await autocomplete({
message: 'Pick a framework.',
placeholder: 'Type to search...',
options: [
{ value: 'next', label: 'Next.js' },
{ value: 'nuxt', label: 'Nuxt' },
{ value: 'sveltekit', label: 'SvelteKit' },
{ value: 'remix', label: 'Remix' },
],
});
```
### Select Key
The `selectKey` component lets a user choose an option by pressing its single-character string `value` key directly.
```js
import { selectKey } from '@clack/prompts';
const action = await selectKey({
message: 'Pick an action.',
options: [
{ value: 'd', label: 'Deploy' },
{ value: 't', label: 'Run tests' },
{ value: 'q', label: 'Quit' },
],
});
```
### Multi-Select
The `multiselect` component allows a user to choose many values from a list of options. The result is an array with all selected `value` props.
@@ -132,6 +199,44 @@ const basket = await groupMultiselect({
});
```
### Multi-Line Text
The multi-line text component accepts multiple lines of text input. By default, pressing `Enter` twice submits the input.
```js
import { multiline } from '@clack/prompts';
const bio = await multiline({
message: 'Tell us about yourself.',
placeholder: 'Start typing...',
validate(value) {
if (value.length === 0) return `value is required`;
},
});
```
Set `showSubmit` to display an explicit submit button instead of double `Enter` submission:
```js
const bio = await multiline({
message: 'Tell us about yourself.',
showSubmit: true,
});
```
### Path
The path component offers filesystem path suggestions and returns the selected path as a string. When `directory: true` is set, only directories can be selected.
```js
import { path } from '@clack/prompts';
const targetDir = await path({
message: 'Select an existing directory.',
directory: true,
});
```
### Spinner
The spinner component surfaces a pending action, such as a long-running download or dependency installation.
@@ -157,7 +262,7 @@ p.start('Downloading archive');
// Do download here
p.advance(3, 'Downloading (30%)');
// ...
p.advance(8, 'Downloading (80%)');
p.advance(5, 'Downloading (80%)');
// ...
p.stop('Archive downloaded');
```