(c Command)
| 81 | } |
| 82 | |
| 83 | func (p *ActionPlan) AddCommand(c Command) error { |
| 84 | ok, err := c.Prepare(p) |
| 85 | if err != nil { |
| 86 | return err |
| 87 | } |
| 88 | |
| 89 | if ok { |
| 90 | key := UniqueKey(c) |
| 91 | if _, exists := p.commandsTracker[key]; !exists { |
| 92 | p.commands = append(p.commands, c) |
| 93 | p.commandsTracker[key] = struct{}{} |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | return nil |
| 98 | } |
| 99 | |
| 100 | // Description returns a string representation of the action plan. |
| 101 | // If verbose is false, the operations are grouped by item type and operation type. |
no test coverage detected