(dockerCLI command.Cli)
| 16 | } |
| 17 | |
| 18 | func newListCommand(dockerCLI command.Cli) *cobra.Command { |
| 19 | var opts listOptions |
| 20 | |
| 21 | cmd := &cobra.Command{ |
| 22 | Use: "ls [OPTIONS] CONTAINER", |
| 23 | Aliases: []string{"list"}, |
| 24 | Short: "List checkpoints for a container", |
| 25 | Args: cli.ExactArgs(1), |
| 26 | RunE: func(cmd *cobra.Command, args []string) error { |
| 27 | return runList(cmd.Context(), dockerCLI, args[0], opts) |
| 28 | }, |
| 29 | ValidArgsFunction: completion.ContainerNames(dockerCLI, false), |
| 30 | DisableFlagsInUseLine: true, |
| 31 | } |
| 32 | |
| 33 | flags := cmd.Flags() |
| 34 | flags.StringVar(&opts.checkpointDir, "checkpoint-dir", "", "Use a custom checkpoint storage directory") |
| 35 | |
| 36 | return cmd |
| 37 | } |
| 38 | |
| 39 | func runList(ctx context.Context, dockerCLI command.Cli, container string, opts listOptions) error { |
| 40 | checkpoints, err := dockerCLI.Client().CheckpointList(ctx, container, client.CheckpointListOptions{ |
searching dependent graphs…