MCPcopy
hub / github.com/crowdsecurity/crowdsec / AddCommand

Method AddCommand

pkg/hubops/plan.go:83–98  ·  view source on GitHub ↗
(c Command)

Source from the content-addressed store, hash-verified

81}
82
83func (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.

Callers 15

installMethod · 0.95
upgradePlanMethod · 0.95
removePlanMethod · 0.95
installMethod · 0.95
upgradeMethod · 0.95
PrepareMethod · 0.80
PrepareMethod · 0.80
PrepareMethod · 0.80
PrepareMethod · 0.80
addSetupMethod · 0.80
NewCommandMethod · 0.80
NewCommandMethod · 0.80

Calls 2

UniqueKeyFunction · 0.85
PrepareMethod · 0.65

Tested by

no test coverage detected