1
0
mirror of https://github.com/go-task/task.git synced 2025-01-12 04:34:11 +02:00
This commit is contained in:
Andrey Nering 2017-07-05 20:10:45 -03:00
parent 06d80e92eb
commit 313d7089da

View File

@ -5,22 +5,27 @@ import (
"strings" "strings"
) )
// Cmd is a task command
type Cmd struct { type Cmd struct {
Cmd string Cmd string
Task string Task string
Vars Vars Vars Vars
} }
// Dep is a task dependency
type Dep struct { type Dep struct {
Task string Task string
Vars Vars Vars Vars
} }
var ( var (
// ErrCantUnmarshalCmd is returned for invalid command YAML
ErrCantUnmarshalCmd = errors.New("task: can't unmarshal cmd value") ErrCantUnmarshalCmd = errors.New("task: can't unmarshal cmd value")
// ErrCantUnmarshalDep is returned for invalid dependency YAML
ErrCantUnmarshalDep = errors.New("task: can't unmarshal dep value") ErrCantUnmarshalDep = errors.New("task: can't unmarshal dep value")
) )
// UnmarshalYAML implements yaml.Unmarshaler interface
func (c *Cmd) UnmarshalYAML(unmarshal func(interface{}) error) error { func (c *Cmd) UnmarshalYAML(unmarshal func(interface{}) error) error {
var cmd string var cmd string
if err := unmarshal(&cmd); err == nil { if err := unmarshal(&cmd); err == nil {
@ -43,6 +48,7 @@ func (c *Cmd) UnmarshalYAML(unmarshal func(interface{}) error) error {
return ErrCantUnmarshalCmd return ErrCantUnmarshalCmd
} }
// UnmarshalYAML implements yaml.Unmarshaler interface
func (d *Dep) UnmarshalYAML(unmarshal func(interface{}) error) error { func (d *Dep) UnmarshalYAML(unmarshal func(interface{}) error) error {
var task string var task string
if err := unmarshal(&task); err == nil { if err := unmarshal(&task); err == nil {