8
8
"encoding/json"
9
9
"fmt"
10
10
"io"
11
- "strings"
12
11
13
12
"github.com/containerd/platforms"
14
13
"github.com/distribution/reference"
@@ -17,6 +16,7 @@ import (
17
16
"github.com/docker/cli/cli/command/completion"
18
17
"github.com/docker/cli/cli/internal/jsonstream"
19
18
"github.com/docker/cli/cli/streams"
19
+ "github.com/docker/cli/internal/tui"
20
20
"github.com/docker/docker/api/types/auxprogress"
21
21
"github.com/docker/docker/api/types/image"
22
22
registrytypes "github.com/docker/docker/api/types/registry"
@@ -86,7 +86,7 @@ func RunPush(ctx context.Context, dockerCli command.Cli, opts pushOptions) error
86
86
}
87
87
platform = & p
88
88
89
- printNote (dockerCli , `Using --platform pushes only the specified platform manifest of a multi-platform image index.
89
+ tui . PrintNote (dockerCli . Err () , `Using --platform pushes only the specified platform manifest of a multi-platform image index.
90
90
Other components, like attestations, will not be included.
91
91
To push the complete multi-platform image, remove the --platform flag.
92
92
` )
@@ -132,8 +132,7 @@ To push the complete multi-platform image, remove the --platform flag.
132
132
133
133
defer func () {
134
134
for _ , note := range notes {
135
- fmt .Fprintln (dockerCli .Err (), "" )
136
- printNote (dockerCli , note )
135
+ tui .PrintNote (dockerCli .Out (), note )
137
136
}
138
137
}()
139
138
@@ -183,25 +182,3 @@ func handleAux() func(jm jsonstream.JSONMessage) {
183
182
}
184
183
}
185
184
}
186
-
187
- func 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
- }
207
- }
0 commit comments