mirror of
https://github.com/jesseduffield/lazydocker.git
synced 2026-07-22 07:11:01 +00:00
Merge e7b4e24704 into 7e7aadc207
This commit is contained in:
commit
f9c4009232
3 changed files with 9 additions and 10 deletions
|
|
@ -2,7 +2,6 @@ package commands
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os/exec"
|
||||
"strings"
|
||||
|
||||
|
|
@ -42,7 +41,7 @@ type Container struct {
|
|||
|
||||
// Remove removes the container
|
||||
func (c *Container) Remove(options container.RemoveOptions) error {
|
||||
c.Log.Warn(fmt.Sprintf("removing container %s", c.Name))
|
||||
c.Log.Warnf("removing container %s", c.Name)
|
||||
if err := c.Client.ContainerRemove(context.Background(), c.ID, options); err != nil {
|
||||
if strings.Contains(err.Error(), "Stop the container before attempting removal or force remove") {
|
||||
return ComplexError{
|
||||
|
|
@ -65,25 +64,25 @@ func (c *Container) Start() error {
|
|||
|
||||
// Stop stops the container
|
||||
func (c *Container) Stop() error {
|
||||
c.Log.Warn(fmt.Sprintf("stopping container %s", c.Name))
|
||||
c.Log.Warnf("stopping container %s", c.Name)
|
||||
return c.Client.ContainerStop(context.Background(), c.ID, container.StopOptions{})
|
||||
}
|
||||
|
||||
// Pause pauses the container
|
||||
func (c *Container) Pause() error {
|
||||
c.Log.Warn(fmt.Sprintf("pausing container %s", c.Name))
|
||||
c.Log.Warnf("pausing container %s", c.Name)
|
||||
return c.Client.ContainerPause(context.Background(), c.ID)
|
||||
}
|
||||
|
||||
// Unpause unpauses the container
|
||||
func (c *Container) Unpause() error {
|
||||
c.Log.Warn(fmt.Sprintf("unpausing container %s", c.Name))
|
||||
c.Log.Warnf("unpausing container %s", c.Name)
|
||||
return c.Client.ContainerUnpause(context.Background(), c.ID)
|
||||
}
|
||||
|
||||
// Restart restarts the container
|
||||
func (c *Container) Restart() error {
|
||||
c.Log.Warn(fmt.Sprintf("restarting container %s", c.Name))
|
||||
c.Log.Warnf("restarting container %s", c.Name)
|
||||
return c.Client.ContainerRestart(context.Background(), c.ID, container.StopOptions{})
|
||||
}
|
||||
|
||||
|
|
@ -102,7 +101,7 @@ func (c *Container) Attach() (*exec.Cmd, error) {
|
|||
return nil, errors.New(c.Tr.CannotAttachStoppedContainerError)
|
||||
}
|
||||
|
||||
c.Log.Warn(fmt.Sprintf("attaching to container %s", c.Name))
|
||||
c.Log.Warnf("attaching to container %s", c.Name)
|
||||
// TODO: use SDK
|
||||
cmd := c.OSCommand.NewCmd("docker", "attach", "--sig-proxy=false", c.ID)
|
||||
return cmd, nil
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ func (c *OSCommand) RunCommandWithOutput(command string) (string, error) {
|
|||
cmd := c.ExecutableFromString(command)
|
||||
before := time.Now()
|
||||
output, err := sanitisedCommandOutput(cmd.Output())
|
||||
c.Log.Warn(fmt.Sprintf("'%s': %s", command, time.Since(before)))
|
||||
c.Log.Warnf("'%s': %s", command, time.Since(before))
|
||||
return output, err
|
||||
}
|
||||
|
||||
|
|
@ -69,7 +69,7 @@ func (c *OSCommand) RunCommandWithOutputContext(ctx context.Context, command str
|
|||
cmd := c.ExecutableFromStringContext(ctx, command)
|
||||
before := time.Now()
|
||||
output, err := sanitisedCommandOutput(cmd.Output())
|
||||
c.Log.Warn(fmt.Sprintf("'%s': %s", command, time.Since(before)))
|
||||
c.Log.Warnf("'%s': %s", command, time.Since(before))
|
||||
return output, err
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ func (gui *Gui) createPopupPanel(title, prompt string, handleConfirm, handleClos
|
|||
gui.g.Update(func(g *gocui.Gui) error {
|
||||
if gui.currentViewName() == "confirmation" {
|
||||
if err := gui.closeConfirmationPrompt(); err != nil {
|
||||
gui.Log.Error(err.Error())
|
||||
gui.Log.Error(err)
|
||||
}
|
||||
}
|
||||
err := gui.prepareConfirmationPanel(title, prompt)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue