|
7 | 7 | "io" |
8 | 8 | "io/ioutil" |
9 | 9 | "os" |
| 10 | + "strings" |
10 | 11 |
|
| 12 | + "github.com/containerd/containerd/platforms" |
11 | 13 | "github.com/deislabs/duffle/pkg/bundle" |
12 | 14 | "github.com/docker/app/internal/packager" |
13 | 15 | "github.com/docker/app/types/metadata" |
@@ -88,7 +90,7 @@ func runPush(dockerCli command.Cli, name string, opts pushOptions) error { |
88 | 90 | } |
89 | 91 |
|
90 | 92 | resolverConfig := remotes.NewResolverConfigFromDockerConfigFile(dockerCli.ConfigFile(), opts.registry.insecureRegistries...) |
91 | | - var display fixupDisplay = &resumeDisplay{out: os.Stdout} |
| 93 | + var display fixupDisplay = &plainDisplay{out: os.Stdout} |
92 | 94 | if term.IsTerminal(os.Stdout.Fd()) { |
93 | 95 | display = &interactiveDisplay{out: os.Stdout} |
94 | 96 | } |
@@ -219,15 +221,10 @@ func (s *interactiveImageState) print(out io.Writer) int { |
219 | 221 | } |
220 | 222 |
|
221 | 223 | func printDescriptorProgress(out io.Writer, p *remotes.DescriptorProgressSnapshot, depth int) int { |
222 | | - for i := 0; i < depth; i++ { |
223 | | - fmt.Fprint(out, " ") |
224 | | - } |
| 224 | + fmt.Fprint(out, strings.Repeat(" ", depth)) |
225 | 225 | name := p.MediaType |
226 | 226 | if p.Platform != nil { |
227 | | - name = fmt.Sprintf("%s/%s", p.Platform.OS, p.Platform.Architecture) |
228 | | - if p.Platform.Variant != "" { |
229 | | - name += "/" + p.Platform.Variant |
230 | | - } |
| 227 | + name = platforms.Format(*p.Platform) |
231 | 228 | } |
232 | 229 | if len(p.Children) == 0 { |
233 | 230 | name = fmt.Sprintf("%s...: %s", p.Digest.String()[:15], p.Action) |
@@ -271,11 +268,11 @@ func hasError(p *remotes.DescriptorProgressSnapshot) bool { |
271 | 268 | return false |
272 | 269 | } |
273 | 270 |
|
274 | | -type resumeDisplay struct { |
| 271 | +type plainDisplay struct { |
275 | 272 | out io.Writer |
276 | 273 | } |
277 | 274 |
|
278 | | -func (r *resumeDisplay) onEvent(ev remotes.FixupEvent) { |
| 275 | +func (r *plainDisplay) onEvent(ev remotes.FixupEvent) { |
279 | 276 | switch ev.EventType { |
280 | 277 | case remotes.FixupEventTypeCopyImageStart: |
281 | 278 | fmt.Fprintf(r.out, "Handling image %s...", ev.SourceImage) |
|
0 commit comments