(ctx context.Context, dockerCli command.Cli, opts historyOptions)
| 57 | } |
| 58 | |
| 59 | func runHistory(ctx context.Context, dockerCli command.Cli, opts historyOptions) error { |
| 60 | var options []client.ImageHistoryOption |
| 61 | if opts.platform != "" { |
| 62 | p, err := platforms.Parse(opts.platform) |
| 63 | if err != nil { |
| 64 | return fmt.Errorf("invalid platform: %w", err) |
| 65 | } |
| 66 | options = append(options, client.ImageHistoryWithPlatform(p)) |
| 67 | } |
| 68 | |
| 69 | history, err := dockerCli.Client().ImageHistory(ctx, opts.image, options...) |
| 70 | if err != nil { |
| 71 | return err |
| 72 | } |
| 73 | |
| 74 | format := opts.format |
| 75 | if len(format) == 0 { |
| 76 | format = formatter.TableFormatKey |
| 77 | } |
| 78 | |
| 79 | historyCtx := formatter.Context{ |
| 80 | Output: dockerCli.Out(), |
| 81 | Format: newHistoryFormat(format, opts.quiet, opts.human), |
| 82 | Trunc: !opts.noTrunc, |
| 83 | } |
| 84 | return historyWrite(historyCtx, opts.human, history) |
| 85 | } |
no test coverage detected
searching dependent graphs…