mirror of
https://github.com/go-task/task.git
synced 2026-06-28 07:04:33 +00:00
feat(vars): add interactive prompting for required variables (#2579)
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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`
|
||||
|
||||
Reference in New Issue
Block a user