Files
docker-cli/cli/command/checkpoint/remove.go
Sebastiaan van Stijn 4b450f113b vendor: github.com/moby/moby/api, moby/client master
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-10 16:32:05 +01:00

38 lines
949 B
Go

package checkpoint
import (
"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
"github.com/moby/moby/client"
"github.com/spf13/cobra"
)
type removeOptions struct {
checkpointDir string
}
func newRemoveCommand(dockerCLI command.Cli) *cobra.Command {
var opts removeOptions
cmd := &cobra.Command{
Use: "rm [OPTIONS] CONTAINER CHECKPOINT",
Aliases: []string{"remove"},
Short: "Remove a checkpoint",
Args: cli.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
containerID, checkpointID := args[0], args[1]
_, err := dockerCLI.Client().CheckpointRemove(cmd.Context(), containerID, client.CheckpointRemoveOptions{
CheckpointID: checkpointID,
CheckpointDir: opts.checkpointDir,
})
return err
},
DisableFlagsInUseLine: true,
}
flags := cmd.Flags()
flags.StringVar(&opts.checkpointDir, "checkpoint-dir", "", "Use a custom checkpoint storage directory")
return cmd
}