@@ -3,24 +3,42 @@ package checkpoint
33import (
44 "golang.org/x/net/context"
55
6+ "github.com/docker/docker/api/types"
67 "github.com/docker/docker/cli"
78 "github.com/docker/docker/cli/command"
89 "github.com/spf13/cobra"
910)
1011
12+ type removeOptions struct {
13+ checkpointDir string
14+ }
15+
1116func newRemoveCommand (dockerCli * command.DockerCli ) * cobra.Command {
12- return & cobra.Command {
17+ var opts removeOptions
18+
19+ cmd := & cobra.Command {
1320 Use : "rm CONTAINER CHECKPOINT" ,
1421 Aliases : []string {"remove" },
1522 Short : "Remove a checkpoint" ,
1623 Args : cli .ExactArgs (2 ),
1724 RunE : func (cmd * cobra.Command , args []string ) error {
18- return runRemove (dockerCli , args [0 ], args [1 ])
25+ return runRemove (dockerCli , args [0 ], args [1 ], opts )
1926 },
2027 }
28+
29+ flags := cmd .Flags ()
30+ flags .StringVarP (& opts .checkpointDir , "checkpoint-dir" , "" , "" , "use a custom checkpoint storage directory" )
31+
32+ return cmd
2133}
2234
23- func runRemove (dockerCli * command.DockerCli , container string , checkpoint string ) error {
35+ func runRemove (dockerCli * command.DockerCli , container string , checkpoint string , opts removeOptions ) error {
2436 client := dockerCli .Client ()
25- return client .CheckpointDelete (context .Background (), container , checkpoint )
37+
38+ removeOpts := types.CheckpointDeleteOptions {
39+ CheckpointID : checkpoint ,
40+ CheckpointDir : opts .checkpointDir ,
41+ }
42+
43+ return client .CheckpointDelete (context .Background (), container , removeOpts )
2644}
0 commit comments