Move all structs related to Taskfile to its own package

This commit is contained in:
Andrey Nering
2018-02-17 14:22:18 -02:00
parent 3212ae4713
commit 152fc0ad38
16 changed files with 223 additions and 203 deletions

View File

@@ -0,0 +1,26 @@
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
}