Merge a process
(newProcess *Process)
| 30 | |
| 31 | // Merge a process |
| 32 | func (p *Process) Merge(newProcess *Process) *Process { |
| 33 | |
| 34 | if newProcess == nil { |
| 35 | return p |
| 36 | } |
| 37 | |
| 38 | if newProcess.Name != "" { |
| 39 | p.Name = newProcess.Name |
| 40 | } |
| 41 | |
| 42 | if p.Process == "" { |
| 43 | p.Process = newProcess.Process |
| 44 | } |
| 45 | |
| 46 | if p.ProcessBind == "" { |
| 47 | p.ProcessBind = newProcess.ProcessBind |
| 48 | } |
| 49 | |
| 50 | if p.Guard == "" { |
| 51 | p.Guard = newProcess.Guard |
| 52 | } |
| 53 | |
| 54 | p.DefaultMerge(newProcess.Default) |
| 55 | return p |
| 56 | } |
| 57 | |
| 58 | // DefaultMerge merge the default value. |
| 59 | // option[0] the default is false, if true overwrite by the default value; |