diff --git a/api.go b/api.go index 151c4ba..53fd460 100644 --- a/api.go +++ b/api.go @@ -11,48 +11,34 @@ func removeContainer(c *docker.Client, id string) { ID: id, Force: true, } - if err := c.RemoveContainer(opts); err != nil { - log.Fatal(err) - } + _ = c.RemoveContainer(opts) } func restartContainer(c *docker.Client, id string) { - if err := c.RestartContainer(id, 5); err != nil { - log.Fatal(err) - } + _ = c.RestartContainer(id, 5) } func unPauseContainer(c *docker.Client, id string) { - if err := c.UnpauseContainer(id); err != nil { - log.Fatal(err) - } + _ = c.UnpauseContainer(id) } func pauseContainer(c *docker.Client, id string) { - if err := c.PauseContainer(id); err != nil { - log.Fatal(err) - } + _ = c.PauseContainer(id) } func killContainer(c *docker.Client, id string) { opts := docker.KillContainerOptions{ ID: id, } - if err := c.KillContainer(opts); err != nil { - log.Fatal(err) - } + _ = c.KillContainer(opts) } func startContainer(c *docker.Client, id string) { - if err := c.StartContainer(id, nil); err != nil { - log.Fatal(err) - } + _ = c.StartContainer(id, nil) } func stopContainer(c *docker.Client, id string) { - if err := c.StopContainer(id, 5); err != nil { - log.Fatal(err) - } + _ = c.StopContainer(id, 5) } func listContainers(c *docker.Client, showAll bool) []docker.APIContainers { diff --git a/main.go b/main.go index 1d6fd42..2987931 100644 --- a/main.go +++ b/main.go @@ -51,7 +51,7 @@ const ( var ( stateStyle = map[string]lipgloss.Style{ "created": lipgloss.NewStyle().Background(midPurple), - "running": lipgloss.NewStyle().Background(hotGreen), + "running": lipgloss.NewStyle().Background(green), "paused": lipgloss.NewStyle().Background(yellow), "restarting": lipgloss.NewStyle().Background(orange), "exited": lipgloss.NewStyle().Background(midPink), @@ -65,7 +65,7 @@ var ( MarginLeft(5) titleStyle = lipgloss.NewStyle(). - Background(celesBlue). + Background(orange). Foreground(black).Bold(true). Align(lipgloss.Center). Blink(true) @@ -238,8 +238,12 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { state := container.state id := container.id if state == "exited" || state == "created" { - startContainer(client, id) - m.logs += "🚀 Started " + container.name + "\n" + go startContainer(client, id) + if err != nil { + m.logs += fmt.Sprintf("🚧 %s\n", err.Error()) + } else { + m.logs += "🚀 Started " + container.name + "\n" + } } else { m.logs += "🚧 " + container.name + " already running\n" } @@ -369,14 +373,14 @@ func (m model) View() string { } } else if m.page == 1 { controls := ` -x - remove container -r - restart container -K - kill container -s - stop container -u - start container -p - pause container -P - unpause container -esc - clear selection +x - remove +r - restart +K - kill +s - stop +u - start +p - pause +P - unpause +esc - clear ? - hide controls` s += controls + "\n"