1
0
mirror of https://github.com/go-task/task.git synced 2025-07-05 00:58:54 +02:00
Files
task/internal/taskfile/taskfile.go
2018-02-17 14:22:18 -02:00

27 lines
531 B
Go

package taskfile
// Taskfile represents a Taskfile.yml
type Taskfile struct {
// TODO: version is still not used
Version int
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 int
Tasks Tasks
}
if err := unmarshal(&taskfile); err != nil {
return err
}
tf.Version = taskfile.Version
tf.Tasks = taskfile.Tasks
return nil
}