This commit is contained in:
@@ -60,6 +60,18 @@ func (self *Commander) GetAgent(aid string) (agent Agent, ok bool) {
|
||||
return
|
||||
}
|
||||
|
||||
// GetAgentByLabel searches for an agent by its human-readable label.
|
||||
func (self *Commander) GetAgentByLabel(label string) (agent Agent, ok bool) {
|
||||
self.mu.RLock()
|
||||
defer self.mu.RUnlock()
|
||||
for _, a := range self.agents {
|
||||
if a.Label == label {
|
||||
return a, true
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (self *Commander) Agents() []Agent {
|
||||
self.mu.RLock()
|
||||
defer self.mu.RUnlock()
|
||||
|
||||
Reference in New Issue
Block a user