feat(vars): add interactive prompting for required variables (#2579)

This commit is contained in:
Valentin Maerten
2026-01-22 21:20:45 +01:00
committed by GitHub
parent c84cfa41f7
commit 6dedcafd7d
19 changed files with 689 additions and 17 deletions

View File

@@ -301,6 +301,19 @@ Automatically answer "yes" to all prompts.
task deploy --yes
```
#### `--interactive`
Enable interactive prompts for missing required variables. When a required
variable is not provided, Task will prompt for input instead of failing.
Task automatically detects non-TTY environments (like CI pipelines) and
skips prompts. This flag can also be set in `.taskrc.yml` to enable prompts
by default.
```bash
task deploy --interactive
```
## Exit Codes
Task uses specific exit codes to indicate different types of errors:

View File

@@ -135,6 +135,20 @@ concurrency: 4
failfast: true
```
### `interactive`
- **Type**: `boolean`
- **Default**: `false`
- **Description**: Prompt for missing required variables instead of failing.
When enabled, Task will display an interactive prompt for any missing required
variable. Requires a TTY. Task automatically detects non-TTY environments
(CI pipelines, etc.) and skips prompts.
- **CLI equivalent**: [`--interactive`](./cli.md#--interactive)
```yaml
interactive: true
```
## Example Configuration
Here's a complete example of a `.taskrc.yml` file with all available options:

View File

@@ -655,7 +655,7 @@ tasks:
#### `requires`
- **Type**: `Requires`
- **Description**: Required variables with optional enums
- **Description**: Required variables with optional enum validation
```yaml
tasks:
@@ -680,6 +680,9 @@ tasks:
- ./deploy.sh
```
See [Prompting for missing variables interactively](/docs/guide#prompting-for-missing-variables-interactively)
for information on enabling interactive prompts for missing required variables.
#### `watch`
- **Type**: `bool`