newDiffCommand creates a new cobra.Command for `docker diff`
(dockerCLI command.Cli)
| 13 | |
| 14 | // newDiffCommand creates a new cobra.Command for `docker diff` |
| 15 | func newDiffCommand(dockerCLI command.Cli) *cobra.Command { |
| 16 | return &cobra.Command{ |
| 17 | Use: "diff CONTAINER", |
| 18 | Short: "Inspect changes to files or directories on a container's filesystem", |
| 19 | Args: cli.ExactArgs(1), |
| 20 | RunE: func(cmd *cobra.Command, args []string) error { |
| 21 | return runDiff(cmd.Context(), dockerCLI, args[0]) |
| 22 | }, |
| 23 | Annotations: map[string]string{ |
| 24 | "aliases": "docker container diff, docker diff", |
| 25 | }, |
| 26 | ValidArgsFunction: completion.ContainerNames(dockerCLI, false), |
| 27 | DisableFlagsInUseLine: true, |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | func runDiff(ctx context.Context, dockerCLI command.Cli, containerID string) error { |
| 32 | res, err := dockerCLI.Client().ContainerDiff(ctx, containerID, client.ContainerDiffOptions{}) |
searching dependent graphs…