MCPcopy
hub / github.com/go-task/task / UnmarshalYAML

Method UnmarshalYAML

taskfile/ast/taskfile.go:84–136  ·  view source on GitHub ↗
(node *yaml.Node)

Source from the content-addressed store, hash-verified

82}
83
84func (tf *Taskfile) UnmarshalYAML(node *yaml.Node) error {
85 switch node.Kind {
86 case yaml.MappingNode:
87 var taskfile struct {
88 Version *semver.Version
89 Output Output
90 Method string
91 Includes *Includes
92 Set []string
93 Shopt []string
94 Vars *Vars
95 Env *Vars
96 Tasks *Tasks
97 Silent bool
98 Dotenv []string
99 Run string
100 Interval time.Duration
101 UseGitignore *bool `yaml:"use_gitignore"`
102 }
103 if err := node.Decode(&taskfile); err != nil {
104 return errors.NewTaskfileDecodeError(err, node)
105 }
106 tf.Version = taskfile.Version
107 tf.Output = taskfile.Output
108 tf.Method = taskfile.Method
109 tf.Includes = taskfile.Includes
110 tf.Set = taskfile.Set
111 tf.Shopt = taskfile.Shopt
112 tf.Vars = taskfile.Vars
113 tf.Env = taskfile.Env
114 tf.Tasks = taskfile.Tasks
115 tf.Silent = taskfile.Silent
116 tf.Dotenv = taskfile.Dotenv
117 tf.Run = taskfile.Run
118 tf.Interval = taskfile.Interval
119 tf.UseGitignore = taskfile.UseGitignore
120 if tf.Includes == nil {
121 tf.Includes = NewIncludes()
122 }
123 if tf.Vars == nil {
124 tf.Vars = NewVars()
125 }
126 if tf.Env == nil {
127 tf.Env = NewVars()
128 }
129 if tf.Tasks == nil {
130 tf.Tasks = NewTasks()
131 }
132 return nil
133 }
134
135 return errors.NewTaskfileDecodeError(nil, node).WithTypeMessage("taskfile")
136}

Callers

nothing calls this directly

Calls 5

NewTaskfileDecodeErrorFunction · 0.92
NewIncludesFunction · 0.85
NewVarsFunction · 0.85
NewTasksFunction · 0.85
WithTypeMessageMethod · 0.80

Tested by

no test coverage detected