mirror of
https://github.com/bcicen/ctop.git
synced 2024-08-30 18:23:19 +00:00
move container state filtering into containermap
This commit is contained in:
parent
a1f860a020
commit
5419337c17
@ -104,9 +104,15 @@ func (cm *ContainerMap) All() []*Container {
|
||||
re := regexp.MustCompile(fmt.Sprintf(".*%s", filter))
|
||||
|
||||
for _, c := range cm.containers {
|
||||
if re.FindAllString(c.name, 1) != nil {
|
||||
containers = append(containers, c)
|
||||
// Apply name filter
|
||||
if re.FindAllString(c.name, 1) == nil {
|
||||
continue
|
||||
}
|
||||
// Apply state filter
|
||||
if !config.GetSwitchVal("allContainers") && c.state != "running" {
|
||||
continue
|
||||
}
|
||||
containers = append(containers, c)
|
||||
}
|
||||
|
||||
sort.Sort(containers)
|
||||
|
Loading…
Reference in New Issue
Block a user