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

feat: node refactor (#1316)

* refactor: node reader interface

* refactor: rewrite Taskfile() as anon recursive func

* chore: NewNodeFromIncludedTaskfile

* chore: changelog
This commit is contained in:
Pete Davison
2023-09-02 15:24:01 -05:00
committed by GitHub
parent b2e6c93b4b
commit afe8a618fe
7 changed files with 286 additions and 194 deletions

View File

@@ -7,7 +7,7 @@ import (
// TaskfileNotFoundError is returned when no appropriate Taskfile is found when
// searching the filesystem.
type TaskfileNotFoundError struct {
Dir string
URI string
Walk bool
}
@@ -16,7 +16,7 @@ func (err TaskfileNotFoundError) Error() string {
if err.Walk {
walkText = " (or any of the parent directories)"
}
return fmt.Sprintf(`task: No Taskfile found in "%s"%s. Use "task --init" to create a new one`, err.Dir, walkText)
return fmt.Sprintf(`task: No Taskfile found at "%s"%s`, err.URI, walkText)
}
func (err TaskfileNotFoundError) Code() int {
@@ -38,12 +38,12 @@ func (err TaskfileAlreadyExistsError) Code() int {
// TaskfileInvalidError is returned when the Taskfile contains syntax errors or
// cannot be parsed for some reason.
type TaskfileInvalidError struct {
FilePath string
Err error
URI string
Err error
}
func (err TaskfileInvalidError) Error() string {
return fmt.Sprintf("task: Failed to parse %s:\n%v", err.FilePath, err.Err)
return fmt.Sprintf("task: Failed to parse %s:\n%v", err.URI, err.Err)
}
func (err TaskfileInvalidError) Code() int {