(ctx context.Context, dockerCli command.Cli, opts diskUsageOptions)
| 41 | } |
| 42 | |
| 43 | func runDiskUsage(ctx context.Context, dockerCli command.Cli, opts diskUsageOptions) error { |
| 44 | // TODO expose types.DiskUsageOptions.Types as flag on the command-line and/or as separate commands (docker container df / docker container usage) |
| 45 | du, err := dockerCli.Client().DiskUsage(ctx, client.DiskUsageOptions{ |
| 46 | Verbose: opts.verbose, |
| 47 | }) |
| 48 | if err != nil { |
| 49 | return err |
| 50 | } |
| 51 | |
| 52 | format := opts.format |
| 53 | if len(format) == 0 { |
| 54 | format = formatter.TableFormatKey |
| 55 | } |
| 56 | |
| 57 | duCtx := formatter.DiskUsageContext{ |
| 58 | Context: formatter.Context{ |
| 59 | Output: dockerCli.Out(), |
| 60 | Format: formatter.NewDiskUsageFormat(format, opts.verbose), |
| 61 | }, |
| 62 | Verbose: opts.verbose, |
| 63 | ImageDiskUsage: du.Images, |
| 64 | BuildCacheDiskUsage: du.BuildCache, |
| 65 | ContainerDiskUsage: du.Containers, |
| 66 | VolumeDiskUsage: du.Volumes, |
| 67 | } |
| 68 | |
| 69 | return duCtx.Write() |
| 70 | } |
no test coverage detected
searching dependent graphs…