Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit c833e2e

Browse files
authored
Merge pull request #2054 from ndeloof/compose.v2
remove all references to cli from compose.v2 cmd package
2 parents 61338d3 + 88ba459 commit c833e2e

33 files changed

+79
-74
lines changed

aci/login/client.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ import (
3434
"github.com/docker/compose-cli/pkg/api"
3535
)
3636

37+
// UserAgentName is the default user agent used by the cli
38+
const UserAgentName = "docker-cli"
39+
3740
// NewContainerGroupsClient get client toi manipulate containerGrouos
3841
func NewContainerGroupsClient(subscriptionID string) (containerinstance.ContainerGroupsClient, error) {
3942
authorizer, mgmtURL, err := getClientSetupData()
@@ -52,7 +55,7 @@ func NewContainerGroupsClient(subscriptionID string) (containerinstance.Containe
5255
}
5356

5457
func setupClient(aciClient *autorest.Client, auth autorest.Authorizer) {
55-
aciClient.UserAgent = internal.UserAgentName + "/" + internal.Version
58+
aciClient.UserAgent = UserAgentName + "/" + internal.Version
5659
aciClient.Authorizer = auth
5760
}
5861

cli/cmd/context/ls.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,13 @@ import (
2323
"sort"
2424
"strings"
2525

26+
formatter2 "github.com/docker/compose-cli/cmd/formatter"
27+
2628
"github.com/pkg/errors"
2729
"github.com/spf13/cobra"
2830

2931
apicontext "github.com/docker/compose-cli/api/context"
3032
"github.com/docker/compose-cli/api/context/store"
31-
"github.com/docker/compose-cli/cli/formatter"
3233
"github.com/docker/compose-cli/cli/mobycli"
3334
)
3435

@@ -68,7 +69,7 @@ func runList(cmd *cobra.Command, opts lsOpts) error {
6869
return err
6970
}
7071
format := strings.ToLower(strings.ReplaceAll(opts.format, " ", ""))
71-
if format != "" && format != formatter.JSON && format != formatter.PRETTY && format != formatter.TemplateLegacyJSON {
72+
if format != "" && format != formatter2.JSON && format != formatter2.PRETTY && format != formatter2.TemplateLegacyJSON {
7273
mobycli.Exec(cmd.Root())
7374
return nil
7475
}
@@ -91,15 +92,15 @@ func runList(cmd *cobra.Command, opts lsOpts) error {
9192
return nil
9293
}
9394

94-
if opts.json || format == formatter.JSON {
95-
opts.format = formatter.JSON
95+
if opts.json || format == formatter2.JSON {
96+
opts.format = formatter2.JSON
9697
}
97-
if format == formatter.TemplateLegacyJSON {
98-
opts.format = formatter.TemplateLegacyJSON
98+
if format == formatter2.TemplateLegacyJSON {
99+
opts.format = formatter2.TemplateLegacyJSON
99100
}
100101

101102
view := viewFromContextList(contexts, currentContext)
102-
return formatter.Print(view, opts.format, os.Stdout,
103+
return formatter2.Print(view, opts.format, os.Stdout,
103104
func(w io.Writer) {
104105
for _, c := range view {
105106
contextName := c.Name

cli/cmd/context/rm.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,13 @@ import (
2020
"errors"
2121
"fmt"
2222

23+
"github.com/docker/compose-cli/cmd/formatter"
24+
2325
"github.com/hashicorp/go-multierror"
2426
"github.com/spf13/cobra"
2527

2628
apicontext "github.com/docker/compose-cli/api/context"
2729
"github.com/docker/compose-cli/api/context/store"
28-
"github.com/docker/compose-cli/cli/formatter"
2930
)
3031

3132
type removeOpts struct {

cli/cmd/inspect.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,15 @@ import (
2020
"context"
2121
"fmt"
2222

23+
"github.com/docker/compose-cli/cmd/formatter"
24+
2325
"github.com/Azure/go-autorest/autorest/to"
2426
"github.com/compose-spec/compose-go/types"
2527
"github.com/pkg/errors"
2628
"github.com/spf13/cobra"
2729

2830
"github.com/docker/compose-cli/api/client"
2931
"github.com/docker/compose-cli/api/containers"
30-
"github.com/docker/compose-cli/cli/formatter"
3132
)
3233

3334
// InspectCommand inspects into containers

cli/cmd/kill.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,13 @@ import (
2020
"context"
2121
"fmt"
2222

23+
"github.com/docker/compose-cli/cmd/formatter"
24+
2325
"github.com/hashicorp/go-multierror"
2426
"github.com/pkg/errors"
2527
"github.com/spf13/cobra"
2628

2729
"github.com/docker/compose-cli/api/client"
28-
"github.com/docker/compose-cli/cli/formatter"
2930
"github.com/docker/compose-cli/pkg/api"
3031
)
3132

cli/cmd/ps.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,13 @@ import (
2323
"os"
2424
"strings"
2525

26+
formatter3 "github.com/docker/compose-cli/cmd/formatter"
27+
2628
"github.com/pkg/errors"
2729
"github.com/spf13/cobra"
2830

2931
"github.com/docker/compose-cli/api/client"
3032
"github.com/docker/compose-cli/api/containers"
31-
formatter2 "github.com/docker/compose-cli/cli/formatter"
3233
"github.com/docker/compose-cli/utils/formatter"
3334
)
3435

@@ -89,11 +90,11 @@ func runPs(ctx context.Context, opts psOpts) error {
8990
}
9091

9192
if opts.json {
92-
opts.format = formatter2.JSON
93+
opts.format = formatter3.JSON
9394
}
9495

9596
view := viewFromContainerList(containerList)
96-
return formatter2.Print(view, opts.format, os.Stdout, func(w io.Writer) {
97+
return formatter3.Print(view, opts.format, os.Stdout, func(w io.Writer) {
9798
for _, c := range view {
9899
_, _ = fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\n", c.ID, c.Image, c.Command, c.Status,
99100
strings.Join(c.Ports, ", "))

cli/cmd/rm.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,14 @@ import (
2020
"context"
2121
"fmt"
2222

23+
"github.com/docker/compose-cli/cmd/formatter"
24+
2325
"github.com/hashicorp/go-multierror"
2426
"github.com/pkg/errors"
2527
"github.com/spf13/cobra"
2628

2729
"github.com/docker/compose-cli/api/client"
2830
"github.com/docker/compose-cli/api/containers"
29-
"github.com/docker/compose-cli/cli/formatter"
3031
"github.com/docker/compose-cli/pkg/api"
3132
)
3233

cli/cmd/secrets.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,12 @@ import (
2222
"io/ioutil"
2323
"os"
2424

25+
"github.com/docker/compose-cli/cmd/formatter"
26+
2527
"github.com/spf13/cobra"
2628

2729
"github.com/docker/compose-cli/api/client"
2830
"github.com/docker/compose-cli/api/secrets"
29-
"github.com/docker/compose-cli/cli/formatter"
3031
)
3132

3233
// SecretCommand manage secrets

cli/cmd/start.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,13 @@ import (
2020
"context"
2121
"fmt"
2222

23+
"github.com/docker/compose-cli/cmd/formatter"
24+
2325
"github.com/hashicorp/go-multierror"
2426
"github.com/pkg/errors"
2527
"github.com/spf13/cobra"
2628

2729
"github.com/docker/compose-cli/api/client"
28-
"github.com/docker/compose-cli/cli/formatter"
2930
"github.com/docker/compose-cli/pkg/api"
3031
)
3132

cli/cmd/stop.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,13 @@ import (
2020
"context"
2121
"fmt"
2222

23+
"github.com/docker/compose-cli/cmd/formatter"
24+
2325
"github.com/hashicorp/go-multierror"
2426
"github.com/pkg/errors"
2527
"github.com/spf13/cobra"
2628

2729
"github.com/docker/compose-cli/api/client"
28-
"github.com/docker/compose-cli/cli/formatter"
2930
"github.com/docker/compose-cli/pkg/api"
3031
)
3132

0 commit comments

Comments
 (0)