mirror of
https://github.com/go-task/task.git
synced 2025-12-24 15:39:28 +01:00
Make dynamic variables run on the right directory
It was always running in the main Taskfile dir, even when the variable was declared in an included taskfile in another directory or when task had a custom dir. Closes #384
This commit is contained in:
1
testdata/dir/dynamic_var/.gitignore
vendored
Normal file
1
testdata/dir/dynamic_var/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
subdirectory/dir.txt
|
||||
11
testdata/dir/dynamic_var/Taskfile.yml
vendored
Normal file
11
testdata/dir/dynamic_var/Taskfile.yml
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
version: '3'
|
||||
|
||||
tasks:
|
||||
default:
|
||||
cmds:
|
||||
- echo '{{.FOLDER}}' > dir.txt
|
||||
dir: subdirectory
|
||||
vars:
|
||||
FOLDER:
|
||||
sh: basename $(pwd)
|
||||
silent: true
|
||||
1
testdata/dir/dynamic_var/subdirectory/dir.txt
vendored
Normal file
1
testdata/dir/dynamic_var/subdirectory/dir.txt
vendored
Normal file
@@ -0,0 +1 @@
|
||||
subdirectory
|
||||
2
testdata/generates/Taskfile.yml
vendored
2
testdata/generates/Taskfile.yml
vendored
@@ -4,7 +4,7 @@ vars:
|
||||
BUILD_DIR: $pwd
|
||||
|
||||
tasks:
|
||||
abs.txt:
|
||||
sub/abs.txt:
|
||||
desc: generates dest file based on absolute paths
|
||||
deps:
|
||||
- sub/src.txt
|
||||
|
||||
Reference in New Issue
Block a user