mirror of
https://github.com/go-task/task.git
synced 2025-06-04 23:38:05 +02:00
Allow included Taskfiles to use ~/* paths
This commit is contained in:
parent
50e5813222
commit
0a6833e9d8
@ -6,6 +6,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"gopkg.in/yaml.v3"
|
"gopkg.in/yaml.v3"
|
||||||
|
|
||||||
@ -51,6 +52,12 @@ func Taskfile(dir string, entrypoint string) (*taskfile.Taskfile, error) {
|
|||||||
|
|
||||||
if filepath.IsAbs(includedTask.Taskfile) {
|
if filepath.IsAbs(includedTask.Taskfile) {
|
||||||
path = includedTask.Taskfile
|
path = includedTask.Taskfile
|
||||||
|
} else if strings.HasPrefix(includedTask.Taskfile, "~") {
|
||||||
|
home, err := os.UserHomeDir()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
path = strings.Replace(includedTask.Taskfile, "~", home, 1)
|
||||||
} else {
|
} else {
|
||||||
path = filepath.Join(dir, includedTask.Taskfile)
|
path = filepath.Join(dir, includedTask.Taskfile)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user