mirror of
https://github.com/go-task/task.git
synced 2025-11-23 22:24:45 +02:00
docs: package api docs (#2169)
* refactor: pass Node into Read method instead of Reader type * docs: add "key packages" and "Reading Taskfiles" sections to package doc
This commit is contained in:
@@ -40,7 +40,6 @@ type (
|
||||
// [ast.TaskfileGraph] from them.
|
||||
Reader struct {
|
||||
graph *ast.TaskfileGraph
|
||||
node Node
|
||||
insecure bool
|
||||
download bool
|
||||
offline bool
|
||||
@@ -54,13 +53,9 @@ type (
|
||||
|
||||
// NewReader constructs a new Taskfile [Reader] using the given Node and
|
||||
// options.
|
||||
func NewReader(
|
||||
node Node,
|
||||
opts ...ReaderOption,
|
||||
) *Reader {
|
||||
func NewReader(opts ...ReaderOption) *Reader {
|
||||
r := &Reader{
|
||||
graph: ast.NewTaskfileGraph(),
|
||||
node: node,
|
||||
insecure: false,
|
||||
download: false,
|
||||
offline: false,
|
||||
@@ -191,8 +186,8 @@ func (o *promptFuncOption) ApplyToReader(r *Reader) {
|
||||
// through any [ast.Includes] it finds, reading each included Taskfile and
|
||||
// building an [ast.TaskfileGraph] as it goes. If any errors occur, they will be
|
||||
// returned immediately.
|
||||
func (r *Reader) Read() (*ast.TaskfileGraph, error) {
|
||||
if err := r.include(r.node); err != nil {
|
||||
func (r *Reader) Read(node Node) (*ast.TaskfileGraph, error) {
|
||||
if err := r.include(node); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return r.graph, nil
|
||||
|
||||
Reference in New Issue
Block a user