mirror of
https://github.com/go-task/task.git
synced 2025-03-19 21:17:46 +02:00
Allow included Taskfiles to use ~/* paths
This commit is contained in:
parent
50e5813222
commit
0a6833e9d8
@ -6,6 +6,7 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
"gopkg.in/yaml.v3"
|
||||
|
||||
@ -51,6 +52,12 @@ func Taskfile(dir string, entrypoint string) (*taskfile.Taskfile, error) {
|
||||
|
||||
if filepath.IsAbs(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 {
|
||||
path = filepath.Join(dir, includedTask.Taskfile)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user