mirror of
https://github.com/go-task/task.git
synced 2026-06-11 09:51:50 +00:00
feat: set and shopt directives (#929)
Co-authored-by: Andrey Nering <andrey@nering.com.br>
This commit is contained in:
@@ -11,6 +11,8 @@ type Cmd struct {
|
||||
Cmd string
|
||||
Silent bool
|
||||
Task string
|
||||
Set []string
|
||||
Shopt []string
|
||||
Vars *Vars
|
||||
IgnoreError bool
|
||||
Defer bool
|
||||
@@ -40,12 +42,16 @@ func (c *Cmd) UnmarshalYAML(node *yaml.Node) error {
|
||||
var cmdStruct struct {
|
||||
Cmd string
|
||||
Silent bool
|
||||
Set []string
|
||||
Shopt []string
|
||||
IgnoreError bool `yaml:"ignore_error"`
|
||||
Platforms []*Platform
|
||||
}
|
||||
if err := node.Decode(&cmdStruct); err == nil && cmdStruct.Cmd != "" {
|
||||
c.Cmd = cmdStruct.Cmd
|
||||
c.Silent = cmdStruct.Silent
|
||||
c.Set = cmdStruct.Set
|
||||
c.Shopt = cmdStruct.Shopt
|
||||
c.IgnoreError = cmdStruct.IgnoreError
|
||||
c.Platforms = cmdStruct.Platforms
|
||||
return nil
|
||||
|
||||
@@ -23,6 +23,8 @@ type Task struct {
|
||||
Status []string
|
||||
Preconditions []*Precondition
|
||||
Dir string
|
||||
Set []string
|
||||
Shopt []string
|
||||
Vars *Vars
|
||||
Env *Vars
|
||||
Dotenv []string
|
||||
@@ -81,6 +83,8 @@ func (t *Task) UnmarshalYAML(node *yaml.Node) error {
|
||||
Status []string
|
||||
Preconditions []*Precondition
|
||||
Dir string
|
||||
Set []string
|
||||
Shopt []string
|
||||
Vars *Vars
|
||||
Env *Vars
|
||||
Dotenv []string
|
||||
@@ -107,6 +111,8 @@ func (t *Task) UnmarshalYAML(node *yaml.Node) error {
|
||||
t.Status = task.Status
|
||||
t.Preconditions = task.Preconditions
|
||||
t.Dir = task.Dir
|
||||
t.Set = task.Set
|
||||
t.Shopt = task.Shopt
|
||||
t.Vars = task.Vars
|
||||
t.Env = task.Env
|
||||
t.Dotenv = task.Dotenv
|
||||
@@ -140,6 +146,8 @@ func (t *Task) DeepCopy() *Task {
|
||||
Status: deepCopySlice(t.Status),
|
||||
Preconditions: deepCopySlice(t.Preconditions),
|
||||
Dir: t.Dir,
|
||||
Set: deepCopySlice(t.Set),
|
||||
Shopt: deepCopySlice(t.Shopt),
|
||||
Vars: t.Vars.DeepCopy(),
|
||||
Env: t.Env.DeepCopy(),
|
||||
Dotenv: deepCopySlice(t.Dotenv),
|
||||
|
||||
@@ -15,6 +15,8 @@ type Taskfile struct {
|
||||
Output Output
|
||||
Method string
|
||||
Includes *IncludedTaskfiles
|
||||
Set []string
|
||||
Shopt []string
|
||||
Vars *Vars
|
||||
Env *Vars
|
||||
Tasks Tasks
|
||||
@@ -34,6 +36,8 @@ func (tf *Taskfile) UnmarshalYAML(node *yaml.Node) error {
|
||||
Output Output
|
||||
Method string
|
||||
Includes *IncludedTaskfiles
|
||||
Set []string
|
||||
Shopt []string
|
||||
Vars *Vars
|
||||
Env *Vars
|
||||
Tasks Tasks
|
||||
@@ -50,6 +54,8 @@ func (tf *Taskfile) UnmarshalYAML(node *yaml.Node) error {
|
||||
tf.Output = taskfile.Output
|
||||
tf.Method = taskfile.Method
|
||||
tf.Includes = taskfile.Includes
|
||||
tf.Set = taskfile.Set
|
||||
tf.Shopt = taskfile.Shopt
|
||||
tf.Vars = taskfile.Vars
|
||||
tf.Env = taskfile.Env
|
||||
tf.Tasks = taskfile.Tasks
|
||||
|
||||
Reference in New Issue
Block a user