We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
default
1 parent fe09c01 commit 47f5e6aCopy full SHA for 47f5e6a
website/docs/usage.mdx
@@ -1212,6 +1212,28 @@ tasks:
1212
- echo "{{.GREETING}}"
1213
```
1214
1215
+Example of a `default` value to be overriden from CLI:
1216
+
1217
+```yaml
1218
+version: '3'
1219
1220
+ greet_user:
1221
+ desc: "Greet the user with a name."
1222
+ vars:
1223
+ USER_NAME: '{{.USER_NAME| default "DefaultUser"}}'
1224
+ cmds:
1225
+ - echo "Hello, {{.USER_NAME}}!"
1226
+```
1227
1228
+```shell
1229
+$ task greet_user
1230
+task: [greet_user] echo "Hello, DefaultUser!"
1231
+Hello, DefaultUser!
1232
+$ task greet_user USER_NAME="Bob"
1233
+task: [greet_user] echo "Hello, Bob!"
1234
+Hello, Bob!
1235
1236
1237
### Dynamic variables
1238
1239
The below syntax (`sh:` prop in a variable) is considered a dynamic variable.
0 commit comments