1
0
mirror of https://github.com/go-task/task.git synced 2025-11-23 22:24:45 +02:00

feat(summary): add vars, env, and requires display

This commit is contained in:
Valentin Maerten
2025-11-16 18:02:41 +01:00
parent a927ffb31e
commit 2d90de8beb
8 changed files with 311 additions and 2 deletions

View File

@@ -0,0 +1,21 @@
version: 3
vars:
GLOBAL_VAR: "I am a global var"
env:
GLOBAL_ENV: "I am a global env"
tasks:
test-env:
desc: Task with vars and env
vars:
LOCAL_VAR: "I am a local var"
env:
LOCAL_ENV: "I am a local env"
DATABASE_URL: "postgres://localhost/mydb"
requires:
vars:
- API_KEY
cmds:
- echo "Testing env vars"

View File

@@ -0,0 +1,16 @@
version: 3
vars:
GLOBAL_VAR: "I am global"
ANOTHER_GLOBAL: "Also global"
tasks:
test-globals:
desc: Task with global and local vars
vars:
LOCAL_VAR: "I am local"
requires:
vars:
- REQUIRED_VAR
cmds:
- echo {{ .GLOBAL_VAR }} {{ .LOCAL_VAR }}

View File

@@ -0,0 +1,36 @@
version: 3
tasks:
mytask:
desc: It does things
summary: |
It does things and has optional and required variables.
vars:
OPTIONAL_VAR: "hello"
requires:
vars:
- REQUIRED_VAR
cmds:
- cmd: echo {{ .OPTIONAL_VAR }} {{ .REQUIRED_VAR }}
with-sh-var:
desc: Task with shell variable
vars:
DYNAMIC_VAR:
sh: echo "world"
STATIC_VAR: "hello"
cmds:
- echo {{ .DYNAMIC_VAR }}
no-vars:
desc: Task without variables
cmds:
- echo "no vars here"
only-requires:
desc: Task with only requires
requires:
vars:
- NEEDED_VAR
cmds:
- echo {{ .NEEDED_VAR }}

View File

@@ -0,0 +1,10 @@
task: with-sh-var
Task with shell variable
vars:
DYNAMIC_VAR: sh: echo "world"
STATIC_VAR: "hello"
commands:
- echo

View File

@@ -0,0 +1,13 @@
task: mytask
It does things and has optional and required variables.
vars:
OPTIONAL_VAR: "hello"
requires:
vars:
- REQUIRED_VAR
commands:
- echo hello