use nicer imports

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
Nicolas De Loof 2021-08-31 16:58:19 +02:00
parent c833e2e4a2
commit c944c970ab
No known key found for this signature in database
GPG Key ID: 9858809D6F8F6E7E
2 changed files with 5 additions and 7 deletions

View File

@ -23,13 +23,12 @@ import (
"os"
"strings"
formatter3 "github.com/docker/compose-cli/cmd/formatter"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"github.com/docker/compose-cli/api/client"
"github.com/docker/compose-cli/api/containers"
format "github.com/docker/compose-cli/cmd/formatter"
"github.com/docker/compose-cli/utils/formatter"
)
@ -90,11 +89,11 @@ func runPs(ctx context.Context, opts psOpts) error {
}
if opts.json {
opts.format = formatter3.JSON
opts.format = format.JSON
}
view := viewFromContainerList(containerList)
return formatter3.Print(view, opts.format, os.Stdout, func(w io.Writer) {
return format.Print(view, opts.format, os.Stdout, func(w io.Writer) {
for _, c := range view {
_, _ = fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\n", c.ID, c.Image, c.Command, c.Status,
strings.Join(c.Ports, ", "))

View File

@ -24,12 +24,11 @@ import (
"sort"
"strings"
formatter2 "github.com/docker/compose-cli/cmd/formatter"
"github.com/docker/docker/pkg/stringid"
"github.com/docker/go-units"
"github.com/spf13/cobra"
"github.com/docker/compose-cli/cmd/formatter"
"github.com/docker/compose-cli/pkg/api"
"github.com/docker/compose-cli/pkg/utils"
)
@ -89,7 +88,7 @@ func runImages(ctx context.Context, backend api.Service, opts imageOptions, serv
return images[i].ContainerName < images[j].ContainerName
})
return formatter2.Print(images, formatter2.PRETTY, os.Stdout,
return formatter.Print(images, formatter.PRETTY, os.Stdout,
func(w io.Writer) {
for _, img := range images {
id := stringid.TruncateID(img.ID)