1
0
mirror of https://github.com/go-task/task.git synced 2024-12-14 10:52:43 +02:00
task/internal/taskfile/taskfile.go
2018-03-03 18:54:42 -03:00

26 lines
501 B
Go

package taskfile
// Taskfile represents a Taskfile.yml
type Taskfile struct {
Version string
Tasks Tasks
}
// UnmarshalYAML implements yaml.Unmarshaler interface
func (tf *Taskfile) UnmarshalYAML(unmarshal func(interface{}) error) error {
if err := unmarshal(&tf.Tasks); err == nil {
return nil
}
var taskfile struct {
Version string
Tasks Tasks
}
if err := unmarshal(&taskfile); err != nil {
return err
}
tf.Version = taskfile.Version
tf.Tasks = taskfile.Tasks
return nil
}