1
0
mirror of https://github.com/go-task/task.git synced 2025-06-15 00:15:10 +02:00

Add Taskfile struct and start implementing new format

Updates #54, #66 and #77
This commit is contained in:
Andrey Nering
2017-12-29 18:27:32 -02:00
parent 00ff1447ee
commit 134c6b79c4
8 changed files with 93 additions and 24 deletions

18
task.go
View File

@ -23,12 +23,12 @@ const (
// Executor executes a Taskfile
type Executor struct {
Tasks Tasks
Dir string
Force bool
Watch bool
Verbose bool
Silent bool
Taskfile *Taskfile
Dir string
Force bool
Watch bool
Verbose bool
Silent bool
Context context.Context
@ -78,8 +78,8 @@ func (e *Executor) Run(calls ...Call) error {
e.Stderr = os.Stderr
}
e.taskCallCount = make(map[string]*int32, len(e.Tasks))
for k := range e.Tasks {
e.taskCallCount = make(map[string]*int32, len(e.Taskfile.Tasks))
for k := range e.Taskfile.Tasks {
e.taskCallCount[k] = new(int32)
}
@ -89,7 +89,7 @@ func (e *Executor) Run(calls ...Call) error {
// check if given tasks exist
for _, c := range calls {
if _, ok := e.Tasks[c.Task]; !ok {
if _, ok := e.Taskfile.Tasks[c.Task]; !ok {
// FIXME: move to the main package
e.PrintTasksHelp()
return &taskNotFoundError{taskName: c.Task}