diff --git a/website/src/docs/guide.md b/website/src/docs/guide.md index 08a18095..a4d6b5e5 100644 --- a/website/src/docs/guide.md +++ b/website/src/docs/guide.md @@ -1398,8 +1398,7 @@ tasks: OS: ['windows', 'linux', 'darwin'] ARCH: ['amd64', 'arm64'] cmd: - echo "{{.ITEM.OS}}/{{.ITEM.ARCH}}" + echo "{{.ITEM.OS}}/{{.ITEM.ARCH}}" ``` This will output: @@ -1432,8 +1431,7 @@ tasks: ARCH: ref: .ARCH_VAR cmd: - echo "{{.ITEM.OS}}/{{.ITEM.ARCH}}" + echo "{{.ITEM.OS}}/{{.ITEM.ARCH}}" ``` ### Looping over your task's sources or generated files @@ -1490,13 +1488,13 @@ tasks: default: vars: MY_DIR: /path/to/dir - dir: '{{.MY_DIR}}' + dir: '{{.MY_DIR}}' sources: - foo.txt - bar.txt cmds: - for: sources - cmd: cat {{joinPath .MY_DIR .ITEM}} + cmd: cat {{joinPath .MY_DIR .ITEM}} ``` ```yaml [Generates] @@ -1506,13 +1504,13 @@ tasks: default: vars: MY_DIR: /path/to/dir - dir: '{{.MY_DIR}}' + dir: '{{.MY_DIR}}' generates: - foo.txt - bar.txt cmds: - for: generates - cmd: cat {{joinPath .MY_DIR .ITEM}} + cmd: cat {{joinPath .MY_DIR .ITEM}} ``` ::: @@ -1532,7 +1530,7 @@ tasks: MY_VAR: foo.txt bar.txt cmds: - for: { var: MY_VAR } - cmd: cat {{.ITEM}} + cmd: cat {{.ITEM}} ``` If you need to split a string on a different character, you can do this by @@ -1547,7 +1545,7 @@ tasks: MY_VAR: foo.txt,bar.txt cmds: - for: { var: MY_VAR, split: ',' } - cmd: cat {{.ITEM}} + cmd: cat {{.ITEM}} ``` You can also loop over arrays and maps directly: @@ -1562,7 +1560,7 @@ tasks: cmds: - for: var: LIST - cmd: echo {{.ITEM}} + cmd: echo {{.ITEM}} ``` When looping over a map we also make an additional `{{.KEY}}` @@ -1581,7 +1579,7 @@ tasks: sh: find -type f -name '*.txt' cmds: - for: { var: MY_VAR } - cmd: cat {{.ITEM}} + cmd: cat {{.ITEM}} ``` ### Renaming variables @@ -1598,7 +1596,7 @@ tasks: MY_VAR: foo.txt bar.txt cmds: - for: { var: MY_VAR, as: FILE } - cmd: cat {{.FILE}} + cmd: cat {{.FILE}} ``` ### Looping over tasks @@ -1616,11 +1614,11 @@ tasks: - for: [foo, bar] task: my-task vars: - FILE: '{{.ITEM}}' + FILE: '{{.ITEM}}' my-task: cmds: - - echo '{{.FILE}}' + - echo '{{.FILE}}' ``` Or if you want to run different tasks depending on the value of the loop: @@ -1632,7 +1630,7 @@ tasks: default: cmds: - for: [foo, bar] - task: task-{{.ITEM}} + task: task-{{.ITEM}} task-foo: cmds: @@ -1657,11 +1655,11 @@ tasks: - for: [foo, bar] task: my-task vars: - FILE: '{{.ITEM}}' + FILE: '{{.ITEM}}' my-task: cmds: - - echo '{{.FILE}}' + - echo '{{.FILE}}' ``` It is important to note that as `deps` are run in parallel, the order in which @@ -1697,7 +1695,7 @@ version: '3' tasks: yarn: cmds: - - yarn {{.CLI_ARGS}} + - yarn {{.CLI_ARGS}} ``` ## Wildcard arguments @@ -1718,17 +1716,16 @@ version: '3' tasks: start:*:*: vars: - SERVICE: '{{index .MATCH 0}}' - REPLICAS: '{{index .MATCH 1}}' + SERVICE: '{{index .MATCH 0}}' + REPLICAS: '{{index .MATCH 1}}' cmds: - - echo "Starting {{.SERVICE}} with {{.REPLICAS}} replicas" + - echo "Starting {{.SERVICE}} with {{.REPLICAS}} replicas" start:*: vars: - SERVICE: '{{index .MATCH 0}}' + SERVICE: '{{index .MATCH 0}}' cmds: - - echo "Starting {{.SERVICE}}" + - echo "Starting {{.SERVICE}}" ``` This call matches the `start:*` task and the string "foo" is captured by the @@ -1811,9 +1808,7 @@ tasks: default: cmds: - defer: - echo '{{if .EXIT_CODE}}Failed with {{.EXIT_CODE}}!{{else}}Success!{{end}}' + echo '{{if .EXIT_CODE}}Failed with {{.EXIT_CODE}}!{{else}}Success!{{end}}' - exit 1 ``` @@ -1944,9 +1939,9 @@ tasks: MESSAGE: world print: - label: 'print-{{.MESSAGE}}' + label: 'print-{{.MESSAGE}}' cmds: - - echo "{{.MESSAGE}}" + - echo "{{.MESSAGE}}" ``` ## Warning Prompts @@ -2189,7 +2184,7 @@ version: '3' output: group: - begin: '::group::{{.TASK}}' + begin: '::group::{{.TASK}}' end: '::endgroup::' tasks: @@ -2252,8 +2247,8 @@ tasks: print: cmds: - - echo "{{.TEXT}}" - prefix: 'print-{{.TEXT}}' + - echo "{{.TEXT}}" + prefix: 'print-{{.TEXT}}' silent: true ``` @@ -2302,11 +2297,11 @@ the default settings (e.g. no custom `env:`, `vars:`, `desc:`, `silent:` , etc): version: '3' tasks: - build: go build -v -o ./app{{exeExt}} . + build: go build -v -o ./app{{exeExt}} . run: - task: build - - ./app{{exeExt}} -h localhost -p 8080 + - ./app{{exeExt}} -h localhost -p 8080 ``` ## `set` and `shopt`