mirror of
https://github.com/go-task/task.git
synced 2024-12-04 10:24:45 +02:00
Add CHANGELOG and improvements to #887
This commit is contained in:
parent
80b417c4ab
commit
44aa2ee3b3
@ -2,6 +2,8 @@
|
||||
|
||||
## Unreleased
|
||||
|
||||
- Now YAML parse errors will print which Taskfile failed to parse
|
||||
([#885](https://github.com/go-task/task/issues/885), [#887](https://github.com/go-task/task/pull/887)).
|
||||
- Add ability to set `aliases` for tasks and namespaces ([#268](https://github.com/go-task/task/pull/268), [#340](https://github.com/go-task/task/pull/340), [#879](https://github.com/go-task/task/pull/879)).
|
||||
- Improvements to Fish shell completion
|
||||
([#897](https://github.com/go-task/task/pull/897)).
|
||||
|
@ -1,6 +1,7 @@
|
||||
package filepathext
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
@ -12,3 +13,19 @@ func SmartJoin(a, b string) string {
|
||||
}
|
||||
return filepath.Join(a, b)
|
||||
}
|
||||
|
||||
// TryAbsToRel tries to convert an absolute path to relative based on the
|
||||
// process working directory. If it can't, it returns the absolute path.
|
||||
func TryAbsToRel(abs string) string {
|
||||
wd, err := os.Getwd()
|
||||
if err != nil {
|
||||
return abs
|
||||
}
|
||||
|
||||
rel, err := filepath.Rel(wd, abs)
|
||||
if err != nil {
|
||||
return abs
|
||||
}
|
||||
|
||||
return rel
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ func readTaskfile(file string) (*taskfile.Taskfile, error) {
|
||||
}
|
||||
var t taskfile.Taskfile
|
||||
if err := yaml.NewDecoder(f).Decode(&t); err != nil {
|
||||
return nil, fmt.Errorf("%s: %w", file, err)
|
||||
return nil, fmt.Errorf("task: Failed to parse %s:\n%w", filepathext.TryAbsToRel(file), err)
|
||||
}
|
||||
return &t, nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user