You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/docs/usage.md
+25-22Lines changed: 25 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1216,7 +1216,9 @@ tasks:
1216
1216
1217
1217
Warning Prompts to prompt a user for confirmation before a task is executed.
1218
1218
1219
-
Below is an example using `prompt` with a dangerous command, that is called between two safe commands
1219
+
Below is an example using `prompt` with a dangerous command, that is called
1220
+
between two safe commands:
1221
+
1220
1222
```yaml
1221
1223
version: '3'
1222
1224
@@ -1229,46 +1231,47 @@ tasks:
1229
1231
1230
1232
not-dangerous:
1231
1233
cmds:
1232
-
- echo 'not dangerous command.'
1234
+
- echo 'not dangerous command'
1233
1235
1234
1236
another-not-dangerous:
1235
1237
cmds:
1236
-
- echo 'another not dangerous command.'
1238
+
- echo 'another not dangerous command'
1237
1239
1238
1240
dangerous:
1239
-
prompt: This is a dangerous command.. Do you want to continue?
1241
+
prompt: This is a dangerous command... Do you want to continue?
1240
1242
cmds:
1241
-
- echo 'dangerous command.'
1242
-
1243
+
- echo 'dangerous command'
1243
1244
```
1245
+
1244
1246
```bash
1245
1247
❯ task dangerous
1246
-
task: "This is a dangerous command.. Do you want to continue?" [y/N]
1248
+
task: "This is a dangerous command... Do you want to continue?" [y/N]
1247
1249
```
1248
1250
1249
-
### Prompt behaviour
1250
-
1251
-
Warning prompts are called before executing a task. If a prompt is denied Task will exit with [Exit code](api_reference.md#exit-codes) 205. If approved, Task will continue as normal.
1251
+
Warning prompts are called before executing a task. If a prompt is denied Task
1252
+
will exit with [exit code](api_reference.md#exit-codes) 205. If approved, Task
task: "This is a dangerous command.. Do you want to continue?" [y/N]
1256
+
❯ task example
1257
+
not dangerous command
1258
+
task: "This is a dangerous command. Do you want to continue?" [y/N]
1258
1259
y
1259
-
task: [dangerous] echo 'dangerous command.'
1260
-
dangerous command.
1261
-
task: [another-not-dangerous] echo 'another not dangerous command.'
1262
-
another not dangerous command.
1260
+
dangerous command
1261
+
another not dangerous command
1263
1262
```
1264
1263
1265
-
### Skipping Warning Prompts
1266
-
1267
-
To skip warning prompts automatically, you can use the [-y | --yes] option when calling the task. By including this option, all warnings, will be automatically confirmed, and no prompts will be shows.
1268
-
1264
+
To skip warning prompts automatically, you can use the `--yes` (alias `-y`)
1265
+
option when calling the task. By including this option, all warnings, will be
1266
+
automatically confirmed, and no prompts will be shown.
1269
1267
1268
+
:::caution
1270
1269
1270
+
Tasks with prompts always fail by default on non-terminal environments, like a
1271
+
CI, where an `stdin` won't be available for the user to answer. In cases like,
1272
+
use `--yes` (`-y`) to force all tasks with a prompt to run.
0 commit comments