88 "encoding/json"
99 "fmt"
1010 "io"
11- "strings"
1211
1312 "github.com/containerd/platforms"
1413 "github.com/distribution/reference"
@@ -17,6 +16,7 @@ import (
1716 "github.com/docker/cli/cli/command/completion"
1817 "github.com/docker/cli/cli/internal/jsonstream"
1918 "github.com/docker/cli/cli/streams"
19+ "github.com/docker/cli/internal/tui"
2020 "github.com/docker/docker/api/types/auxprogress"
2121 "github.com/docker/docker/api/types/image"
2222 registrytypes "github.com/docker/docker/api/types/registry"
@@ -132,7 +132,6 @@ To push the complete multi-platform image, remove the --platform flag.
132132
133133 defer func () {
134134 for _ , note := range notes {
135- fmt .Fprintln (dockerCli .Err (), "" )
136135 printNote (dockerCli , note )
137136 }
138137 }()
@@ -185,23 +184,5 @@ func handleAux() func(jm jsonstream.JSONMessage) {
185184}
186185
187186func printNote (dockerCli command.Cli , format string , args ... any ) {
188- if dockerCli .Err ().IsTerminal () {
189- format = strings .ReplaceAll (format , "--platform" , aec .Bold .Apply ("--platform" ))
190- }
191-
192- header := " Info -> "
193- padding := len (header )
194- if dockerCli .Err ().IsTerminal () {
195- padding = len ("i Info > " )
196- header = aec .Bold .Apply (aec .LightCyanB .Apply (aec .BlackF .Apply ("i" )) + " " + aec .LightCyanF .Apply ("Info → " ))
197- }
198-
199- _ , _ = fmt .Fprint (dockerCli .Err (), header )
200- s := fmt .Sprintf (format , args ... )
201- for idx , line := range strings .Split (s , "\n " ) {
202- if idx > 0 {
203- _ , _ = fmt .Fprint (dockerCli .Err (), strings .Repeat (" " , padding ))
204- }
205- _ , _ = fmt .Fprintln (dockerCli .Err (), aec .Italic .Apply (line ))
206- }
187+ tui .PrintNote (dockerCli .Err (), format , args ... )
207188}
0 commit comments