mirror of
https://github.com/go-task/task.git
synced 2026-06-24 21:26:04 +00: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:
18
taskfile/read/node_base.go
Normal file
18
taskfile/read/node_base.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package read
|
||||
|
||||
// BaseNode is a generic node that implements the Parent() and Optional()
|
||||
// methods of the NodeReader interface. It does not implement the Read() method
|
||||
// and it designed to be embedded in other node types so that this boilerplate
|
||||
// code does not need to be repeated.
|
||||
type BaseNode struct {
|
||||
parent Node
|
||||
optional bool
|
||||
}
|
||||
|
||||
func (node *BaseNode) Parent() Node {
|
||||
return node.parent
|
||||
}
|
||||
|
||||
func (node *BaseNode) Optional() bool {
|
||||
return node.optional
|
||||
}
|
||||
Reference in New Issue
Block a user