2018-02-17 18:22:18 +02:00
|
|
|
package taskfile
|
|
|
|
|
|
|
|
// Taskfile represents a Taskfile.yml
|
|
|
|
type Taskfile struct {
|
2018-03-03 23:54:42 +02:00
|
|
|
Version string
|
2018-02-17 18:22:18 +02:00
|
|
|
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 {
|
2018-03-03 23:54:42 +02:00
|
|
|
Version string
|
2018-02-17 18:22:18 +02:00
|
|
|
Tasks Tasks
|
|
|
|
}
|
|
|
|
if err := unmarshal(&taskfile); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
tf.Version = taskfile.Version
|
|
|
|
tf.Tasks = taskfile.Tasks
|
|
|
|
return nil
|
|
|
|
}
|