diff --git a/main.go b/main.go index cfe1fba..eca81a1 100644 --- a/main.go +++ b/main.go @@ -525,15 +525,15 @@ func (self *DockerGUI) refresh_data() { } func (self *DockerGUI) refresh_containers() { - scroll_position := self.containers_tree.VerticalScrollBar().Value() - selected_items := self.get_selected_items(self.containers_tree) - self.containers_tree.Clear() - output, err := dockerCommand("ps", "-a", "--format", "{{.ID}}\\t{{.Names}}\\t{{.Image}}\\t{{.Status}}\\t{{.Ports}}").Output() if err != nil { panic(err) } + scroll_position := self.containers_tree.VerticalScrollBar().Value() + selected_items := self.get_selected_items(self.containers_tree) + self.containers_tree.Clear() + containers := strings.Split(strings.TrimSpace(string(output)), "\n") for _, container := range containers { parts := strings.Split(container, "\t") @@ -563,15 +563,15 @@ func (self *DockerGUI) refresh_containers() { } func (self *DockerGUI) refresh_images() { - scroll_position := self.images_tree.VerticalScrollBar().Value() - selected_items := self.get_selected_items(self.images_tree) - self.images_tree.Clear() - output, err := dockerCommand("images", "--format", "{{.ID}}\\t{{.Repository}}\\t{{.Tag}}\\t{{.Size}}").Output() if err != nil { panic(err) } + scroll_position := self.images_tree.VerticalScrollBar().Value() + selected_items := self.get_selected_items(self.images_tree) + self.images_tree.Clear() + images := strings.Split(strings.TrimSpace(string(output)), "\n") for _, image := range images { parts := strings.Split(image, "\t") @@ -595,15 +595,15 @@ func (self *DockerGUI) refresh_images() { } func (self *DockerGUI) refresh_networks() { - scroll_position := self.networks_tree.VerticalScrollBar().Value() - selected_items := self.get_selected_items(self.networks_tree) - self.networks_tree.Clear() - output, err := dockerCommand("network", "ls", "--format", "{{.ID}}\\t{{.Name}}\\t{{.Driver}}").Output() if err != nil { panic(err) } + scroll_position := self.networks_tree.VerticalScrollBar().Value() + selected_items := self.get_selected_items(self.networks_tree) + self.networks_tree.Clear() + networks := strings.Split(strings.TrimSpace(string(output)), "\n") for _, network := range networks { parts := strings.Split(network, "\t") @@ -625,15 +625,15 @@ func (self *DockerGUI) refresh_networks() { } func (self *DockerGUI) refresh_volumes() { - scroll_position := self.volumes_tree.VerticalScrollBar().Value() - selected_items := self.get_selected_items(self.volumes_tree) - self.volumes_tree.Clear() - output, err := dockerCommand("volume", "ls", "--format", "{{.Name}}\\t{{.Driver}}\\t{{.Mountpoint}}").Output() if err != nil { panic(err) } + scroll_position := self.volumes_tree.VerticalScrollBar().Value() + selected_items := self.get_selected_items(self.volumes_tree) + self.volumes_tree.Clear() + volumes := strings.Split(strings.TrimSpace(string(output)), "\n") for _, volume := range volumes { parts := strings.Split(volume, "\t")