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

Add --taskfile flag (alias -t) to allow running another Taskfile

Closes #221
This commit is contained in:
Andrey Nering
2019-07-21 10:54:09 -03:00
parent 762714de68
commit d970e93507
4 changed files with 43 additions and 22 deletions

22
task.go
View File

@ -32,13 +32,15 @@ const (
// Executor executes a Taskfile
type Executor struct {
Taskfile *taskfile.Taskfile
Dir string
Force bool
Watch bool
Verbose bool
Silent bool
Dry bool
Summary bool
Dir string
Entrypoint string
Force bool
Watch bool
Verbose bool
Silent bool
Dry bool
Summary bool
Stdin io.Reader
Stdout io.Writer
@ -85,8 +87,12 @@ func (e *Executor) Run(ctx context.Context, calls ...taskfile.Call) error {
// Setup setups Executor's internal state
func (e *Executor) Setup() error {
if e.Entrypoint == "" {
e.Entrypoint = "Taskfile.yml"
}
var err error
e.Taskfile, err = read.Taskfile(e.Dir)
e.Taskfile, err = read.Taskfile(e.Dir, e.Entrypoint)
if err != nil {
return err
}