Browse Source

Merge pull request #1150 from gtardif/refacto_folders

Refacto folders
Nicolas De loof 4 years ago
parent
commit
54020db517
100 changed files with 109 additions and 211 deletions
  1. 3 3
      aci/aci.go
  2. 5 4
      aci/backend.go
  3. 2 2
      aci/compose.go
  4. 2 2
      aci/containers.go
  5. 3 3
      aci/context.go
  6. 1 1
      aci/context_test.go
  7. 1 1
      aci/convert/convert.go
  8. 1 1
      aci/convert/convert_test.go
  9. 1 1
      aci/convert/volume.go
  10. 1 1
      aci/login/client.go
  11. 1 1
      aci/login/login.go
  12. 1 1
      aci/login/storagelogin.go
  13. 1 1
      aci/resources.go
  14. 3 3
      aci/volumes.go
  15. 2 2
      api/backend/backend.go
  16. 4 4
      api/client/client.go
  17. 1 1
      api/client/compose.go
  18. 1 1
      api/client/containers.go
  19. 1 1
      api/client/resources.go
  20. 1 1
      api/client/secrets.go
  21. 1 1
      api/client/volume.go
  22. 1 1
      api/cloud/api.go
  23. 1 1
      api/config/config.go
  24. 0 0
      api/config/config_test.go
  25. 0 0
      api/config/keys.go
  26. 2 2
      api/containers/api.go
  27. 0 0
      api/context/context.go
  28. 0 0
      api/context/flags.go
  29. 0 0
      api/context/store/contextmetadata.go
  30. 0 0
      api/context/store/contextmetadata_test.go
  31. 1 1
      api/context/store/store.go
  32. 1 1
      api/context/store/store_test.go
  33. 0 0
      api/context/store/storedefault.go
  34. 0 0
      api/errdefs/errors.go
  35. 0 0
      api/errdefs/errors_test.go
  36. 0 0
      api/progress/event.go
  37. 0 0
      api/progress/noop.go
  38. 0 0
      api/progress/plain.go
  39. 0 0
      api/progress/spinner.go
  40. 0 0
      api/progress/tty.go
  41. 0 0
      api/progress/tty_test.go
  42. 0 0
      api/progress/writer.go
  43. 0 0
      api/progress/writer_test.go
  44. 1 1
      cli/cmd/compose/build.go
  45. 1 1
      cli/cmd/compose/compose.go
  46. 1 1
      cli/cmd/compose/down.go
  47. 1 1
      cli/cmd/compose/list.go
  48. 1 1
      cli/cmd/compose/logs.go
  49. 1 1
      cli/cmd/compose/ps.go
  50. 1 1
      cli/cmd/compose/pull.go
  51. 1 1
      cli/cmd/compose/push.go
  52. 1 1
      cli/cmd/compose/run.go
  53. 3 3
      cli/cmd/compose/up.go
  54. 1 1
      cli/cmd/context/create.go
  55. 2 2
      cli/cmd/context/create_aci.go
  56. 5 4
      cli/cmd/context/create_ecs.go
  57. 3 3
      cli/cmd/context/ls.go
  58. 2 2
      cli/cmd/context/rm.go
  59. 2 2
      cli/cmd/context/show.go
  60. 2 2
      cli/cmd/context/update.go
  61. 2 2
      cli/cmd/context/use.go
  62. 1 1
      cli/cmd/inspect.go
  63. 0 34
      cli/cmd/inspect_test.go
  64. 1 1
      cli/cmd/kill.go
  65. 1 1
      cli/cmd/login/login.go
  66. 1 1
      cli/cmd/logout/azure.go
  67. 1 1
      cli/cmd/ps.go
  68. 0 51
      cli/cmd/ps_test.go
  69. 1 1
      cli/cmd/rm.go
  70. 2 2
      cli/cmd/run/run.go
  71. 1 1
      cli/cmd/secrets.go
  72. 7 7
      cli/cmd/serve.go
  73. 1 1
      cli/cmd/start.go
  74. 1 1
      cli/cmd/stop.go
  75. 0 14
      cli/cmd/testdata/inspect-out-id.golden
  76. 0 2
      cli/cmd/testdata/ps-out-quiet.golden
  77. 0 3
      cli/cmd/testdata/ps-out.golden
  78. 1 1
      cli/cmd/version.go
  79. 3 3
      cli/cmd/volume/command.go
  80. 1 1
      cli/cmd/volume/list.go
  81. 1 1
      cli/config/flags.go
  82. 0 0
      cli/formatter/colors.go
  83. 0 0
      cli/formatter/consts.go
  84. 1 1
      cli/formatter/formatter.go
  85. 0 0
      cli/formatter/formatter_test.go
  86. 0 0
      cli/formatter/json.go
  87. 0 0
      cli/formatter/logs.go
  88. 0 0
      cli/formatter/pretty.go
  89. 5 5
      cli/main.go
  90. 1 1
      cli/main_test.go
  91. 0 0
      cli/metrics/client.go
  92. 0 0
      cli/metrics/commands.go
  93. 0 0
      cli/metrics/conn_e2e.go
  94. 0 0
      cli/metrics/conn_other.go
  95. 0 0
      cli/metrics/conn_windows.go
  96. 0 0
      cli/metrics/generatecommands/main.go
  97. 0 0
      cli/metrics/metrics.go
  98. 0 0
      cli/metrics/metrics_test.go
  99. 3 3
      cli/mobycli/exec.go
  100. 1 1
      cli/mobycli/exec_test.go

+ 3 - 3
aci/aci.go

@@ -38,9 +38,9 @@ import (
 	"github.com/docker/compose-cli/aci/login"
 	"github.com/docker/compose-cli/api/client"
 	"github.com/docker/compose-cli/api/containers"
-	"github.com/docker/compose-cli/context/store"
-	"github.com/docker/compose-cli/errdefs"
-	"github.com/docker/compose-cli/progress"
+	"github.com/docker/compose-cli/api/context/store"
+	"github.com/docker/compose-cli/api/errdefs"
+	"github.com/docker/compose-cli/api/progress"
 )
 
 func createACIContainers(ctx context.Context, aciContext store.AciContext, groupDefinition containerinstance.ContainerGroup) error {

+ 5 - 4
aci/backend.go

@@ -26,15 +26,16 @@ import (
 
 	"github.com/docker/compose-cli/aci/convert"
 	"github.com/docker/compose-cli/aci/login"
+	"github.com/docker/compose-cli/api/backend"
 	"github.com/docker/compose-cli/api/compose"
 	"github.com/docker/compose-cli/api/containers"
 	"github.com/docker/compose-cli/api/resources"
 	"github.com/docker/compose-cli/api/secrets"
 	"github.com/docker/compose-cli/api/volumes"
-	"github.com/docker/compose-cli/backend"
-	apicontext "github.com/docker/compose-cli/context"
-	"github.com/docker/compose-cli/context/cloud"
-	"github.com/docker/compose-cli/context/store"
+
+	"github.com/docker/compose-cli/api/cloud"
+	apicontext "github.com/docker/compose-cli/api/context"
+	"github.com/docker/compose-cli/api/context/store"
 )
 
 const (

+ 2 - 2
aci/compose.go

@@ -27,8 +27,8 @@ import (
 	"github.com/docker/compose-cli/aci/convert"
 	"github.com/docker/compose-cli/aci/login"
 	"github.com/docker/compose-cli/api/compose"
-	"github.com/docker/compose-cli/context/store"
-	"github.com/docker/compose-cli/errdefs"
+	"github.com/docker/compose-cli/api/context/store"
+	"github.com/docker/compose-cli/api/errdefs"
 	"github.com/docker/compose-cli/utils/formatter"
 )
 

+ 2 - 2
aci/containers.go

@@ -32,8 +32,8 @@ import (
 	"github.com/docker/compose-cli/aci/convert"
 	"github.com/docker/compose-cli/aci/login"
 	"github.com/docker/compose-cli/api/containers"
-	"github.com/docker/compose-cli/context/store"
-	"github.com/docker/compose-cli/errdefs"
+	"github.com/docker/compose-cli/api/context/store"
+	"github.com/docker/compose-cli/api/errdefs"
 )
 
 type aciContainerService struct {

+ 3 - 3
aci/context.go

@@ -27,9 +27,9 @@ import (
 	"github.com/hashicorp/go-uuid"
 	"github.com/pkg/errors"
 
-	"github.com/docker/compose-cli/context/store"
-	"github.com/docker/compose-cli/errdefs"
-	"github.com/docker/compose-cli/prompt"
+	"github.com/docker/compose-cli/api/context/store"
+	"github.com/docker/compose-cli/api/errdefs"
+	"github.com/docker/compose-cli/utils/prompt"
 )
 
 // ContextParams options for creating ACI context

+ 1 - 1
aci/context_test.go

@@ -28,7 +28,7 @@ import (
 	"gotest.tools/v3/assert"
 	"gotest.tools/v3/assert/cmp"
 
-	"github.com/docker/compose-cli/context/store"
+	"github.com/docker/compose-cli/api/context/store"
 )
 
 type contextMocks struct {

+ 1 - 1
aci/convert/convert.go

@@ -33,7 +33,7 @@ import (
 	"github.com/docker/compose-cli/aci/login"
 	"github.com/docker/compose-cli/api/compose"
 	"github.com/docker/compose-cli/api/containers"
-	"github.com/docker/compose-cli/context/store"
+	"github.com/docker/compose-cli/api/context/store"
 	"github.com/docker/compose-cli/utils/formatter"
 )
 

+ 1 - 1
aci/convert/convert_test.go

@@ -30,7 +30,7 @@ import (
 
 	"github.com/docker/compose-cli/api/compose"
 	"github.com/docker/compose-cli/api/containers"
-	"github.com/docker/compose-cli/context/store"
+	"github.com/docker/compose-cli/api/context/store"
 )
 
 var (

+ 1 - 1
aci/convert/volume.go

@@ -30,7 +30,7 @@ import (
 	"github.com/compose-spec/compose-go/types"
 
 	"github.com/docker/compose-cli/aci/login"
-	"github.com/docker/compose-cli/errdefs"
+	"github.com/docker/compose-cli/api/errdefs"
 )
 
 const (

+ 1 - 1
aci/login/client.go

@@ -26,7 +26,7 @@ import (
 	"github.com/Azure/go-autorest/autorest"
 	"github.com/pkg/errors"
 
-	"github.com/docker/compose-cli/errdefs"
+	"github.com/docker/compose-cli/api/errdefs"
 	"github.com/docker/compose-cli/internal"
 )
 

+ 1 - 1
aci/login/login.go

@@ -33,7 +33,7 @@ import (
 	"github.com/pkg/errors"
 	"golang.org/x/oauth2"
 
-	"github.com/docker/compose-cli/errdefs"
+	"github.com/docker/compose-cli/api/errdefs"
 )
 
 //go login process, derived from code sample provided by MS at https://github.com/devigned/go-az-cli-stuff

+ 1 - 1
aci/login/storagelogin.go

@@ -22,7 +22,7 @@ import (
 
 	"github.com/pkg/errors"
 
-	"github.com/docker/compose-cli/context/store"
+	"github.com/docker/compose-cli/api/context/store"
 )
 
 // StorageLogin helper for Azure Storage Login

+ 1 - 1
aci/resources.go

@@ -23,8 +23,8 @@ import (
 	"github.com/hashicorp/go-multierror"
 
 	"github.com/docker/compose-cli/aci/convert"
+	"github.com/docker/compose-cli/api/context/store"
 	"github.com/docker/compose-cli/api/resources"
-	"github.com/docker/compose-cli/context/store"
 )
 
 type aciResourceService struct {

+ 3 - 3
aci/volumes.go

@@ -29,10 +29,10 @@ import (
 	"github.com/Azure/go-autorest/autorest/to"
 
 	"github.com/docker/compose-cli/aci/login"
+	"github.com/docker/compose-cli/api/context/store"
+	"github.com/docker/compose-cli/api/errdefs"
+	"github.com/docker/compose-cli/api/progress"
 	"github.com/docker/compose-cli/api/volumes"
-	"github.com/docker/compose-cli/context/store"
-	"github.com/docker/compose-cli/errdefs"
-	"github.com/docker/compose-cli/progress"
 )
 
 type aciVolumeService struct {

+ 2 - 2
backend/backend.go → api/backend/backend.go

@@ -23,13 +23,13 @@ import (
 
 	"github.com/sirupsen/logrus"
 
+	"github.com/docker/compose-cli/api/cloud"
 	"github.com/docker/compose-cli/api/compose"
 	"github.com/docker/compose-cli/api/containers"
+	"github.com/docker/compose-cli/api/errdefs"
 	"github.com/docker/compose-cli/api/resources"
 	"github.com/docker/compose-cli/api/secrets"
 	"github.com/docker/compose-cli/api/volumes"
-	"github.com/docker/compose-cli/context/cloud"
-	"github.com/docker/compose-cli/errdefs"
 )
 
 var (

+ 4 - 4
api/client/client.go

@@ -19,15 +19,15 @@ package client
 import (
 	"context"
 
+	"github.com/docker/compose-cli/api/backend"
+	"github.com/docker/compose-cli/api/cloud"
 	"github.com/docker/compose-cli/api/compose"
 	"github.com/docker/compose-cli/api/containers"
+	apicontext "github.com/docker/compose-cli/api/context"
+	"github.com/docker/compose-cli/api/context/store"
 	"github.com/docker/compose-cli/api/resources"
 	"github.com/docker/compose-cli/api/secrets"
 	"github.com/docker/compose-cli/api/volumes"
-	"github.com/docker/compose-cli/backend"
-	apicontext "github.com/docker/compose-cli/context"
-	"github.com/docker/compose-cli/context/cloud"
-	"github.com/docker/compose-cli/context/store"
 )
 
 // New returns a backend client associated with current context

+ 1 - 1
api/client/compose.go

@@ -20,7 +20,7 @@ import (
 	"context"
 
 	"github.com/docker/compose-cli/api/compose"
-	"github.com/docker/compose-cli/errdefs"
+	"github.com/docker/compose-cli/api/errdefs"
 
 	"github.com/compose-spec/compose-go/types"
 )

+ 1 - 1
api/client/containers.go

@@ -20,7 +20,7 @@ import (
 	"context"
 
 	"github.com/docker/compose-cli/api/containers"
-	"github.com/docker/compose-cli/errdefs"
+	"github.com/docker/compose-cli/api/errdefs"
 )
 
 type containerService struct {

+ 1 - 1
api/client/resources.go

@@ -19,8 +19,8 @@ package client
 import (
 	"context"
 
+	"github.com/docker/compose-cli/api/errdefs"
 	"github.com/docker/compose-cli/api/resources"
-	"github.com/docker/compose-cli/errdefs"
 )
 
 type resourceService struct {

+ 1 - 1
api/client/secrets.go

@@ -19,8 +19,8 @@ package client
 import (
 	"context"
 
+	"github.com/docker/compose-cli/api/errdefs"
 	"github.com/docker/compose-cli/api/secrets"
-	"github.com/docker/compose-cli/errdefs"
 )
 
 type secretsService struct {

+ 1 - 1
api/client/volume.go

@@ -19,8 +19,8 @@ package client
 import (
 	"context"
 
+	"github.com/docker/compose-cli/api/errdefs"
 	"github.com/docker/compose-cli/api/volumes"
-	"github.com/docker/compose-cli/errdefs"
 )
 
 type volumeService struct {

+ 1 - 1
context/cloud/api.go → api/cloud/api.go

@@ -19,7 +19,7 @@ package cloud
 import (
 	"context"
 
-	"github.com/docker/compose-cli/errdefs"
+	"github.com/docker/compose-cli/api/errdefs"
 )
 
 // Service cloud specific services

+ 1 - 1
config/config.go → api/config/config.go

@@ -25,7 +25,7 @@ import (
 
 	"github.com/pkg/errors"
 
-	"github.com/docker/compose-cli/context/store"
+	"github.com/docker/compose-cli/api/context/store"
 )
 
 type dirKey struct{}

+ 0 - 0
config/config_test.go → api/config/config_test.go


+ 0 - 0
config/keys.go → api/config/keys.go


+ 2 - 2
api/containers/api.go

@@ -23,7 +23,7 @@ import (
 	"github.com/compose-spec/compose-go/types"
 	specs "github.com/opencontainers/image-spec/specs-go/v1"
 
-	"github.com/docker/compose-cli/formatter"
+	"github.com/docker/compose-cli/utils"
 )
 
 const (
@@ -102,7 +102,7 @@ type ContainerConfig struct {
 	// Volumes to be mounted
 	Volumes []string
 	// Memlimit
-	MemLimit formatter.MemBytes
+	MemLimit utils.MemBytes
 	// CPUlimit
 	CPULimit float64
 	// Environment variables

+ 0 - 0
context/context.go → api/context/context.go


+ 0 - 0
context/flags.go → api/context/flags.go


+ 0 - 0
context/store/contextmetadata.go → api/context/store/contextmetadata.go


+ 0 - 0
context/store/contextmetadata_test.go → api/context/store/contextmetadata_test.go


+ 1 - 1
context/store/store.go → api/context/store/store.go

@@ -28,7 +28,7 @@ import (
 	"github.com/opencontainers/go-digest"
 	"github.com/pkg/errors"
 
-	"github.com/docker/compose-cli/errdefs"
+	"github.com/docker/compose-cli/api/errdefs"
 )
 
 const (

+ 1 - 1
context/store/store_test.go → api/context/store/store_test.go

@@ -25,7 +25,7 @@ import (
 	"gotest.tools/v3/assert"
 	"gotest.tools/v3/assert/cmp"
 
-	"github.com/docker/compose-cli/errdefs"
+	"github.com/docker/compose-cli/api/errdefs"
 )
 
 func testStore(t *testing.T) Store {

+ 0 - 0
context/store/storedefault.go → api/context/store/storedefault.go


+ 0 - 0
errdefs/errors.go → api/errdefs/errors.go


+ 0 - 0
errdefs/errors_test.go → api/errdefs/errors_test.go


+ 0 - 0
progress/event.go → api/progress/event.go


+ 0 - 0
progress/noop.go → api/progress/noop.go


+ 0 - 0
progress/plain.go → api/progress/plain.go


+ 0 - 0
progress/spinner.go → api/progress/spinner.go


+ 0 - 0
progress/tty.go → api/progress/tty.go


+ 0 - 0
progress/tty_test.go → api/progress/tty_test.go


+ 0 - 0
progress/writer.go → api/progress/writer.go


+ 0 - 0
progress/writer_test.go → api/progress/writer_test.go


+ 1 - 1
cli/cmd/compose/build.go

@@ -23,7 +23,7 @@ import (
 	"github.com/spf13/cobra"
 
 	"github.com/docker/compose-cli/api/client"
-	"github.com/docker/compose-cli/progress"
+	"github.com/docker/compose-cli/api/progress"
 )
 
 type buildOptions struct {

+ 1 - 1
cli/cmd/compose/compose.go

@@ -24,7 +24,7 @@ import (
 	"github.com/spf13/cobra"
 	"github.com/spf13/pflag"
 
-	"github.com/docker/compose-cli/context/store"
+	"github.com/docker/compose-cli/api/context/store"
 )
 
 type composeOptions struct {

+ 1 - 1
cli/cmd/compose/down.go

@@ -24,7 +24,7 @@ import (
 	"github.com/spf13/cobra"
 
 	"github.com/docker/compose-cli/api/client"
-	"github.com/docker/compose-cli/progress"
+	"github.com/docker/compose-cli/api/progress"
 )
 
 func downCommand() *cobra.Command {

+ 1 - 1
cli/cmd/compose/list.go

@@ -27,7 +27,7 @@ import (
 
 	"github.com/docker/compose-cli/api/client"
 	"github.com/docker/compose-cli/api/compose"
-	"github.com/docker/compose-cli/formatter"
+	"github.com/docker/compose-cli/cli/formatter"
 )
 
 func listCommand() *cobra.Command {

+ 1 - 1
cli/cmd/compose/logs.go

@@ -24,7 +24,7 @@ import (
 
 	"github.com/docker/compose-cli/api/client"
 	"github.com/docker/compose-cli/api/compose"
-	"github.com/docker/compose-cli/formatter"
+	"github.com/docker/compose-cli/cli/formatter"
 )
 
 func logsCommand() *cobra.Command {

+ 1 - 1
cli/cmd/compose/ps.go

@@ -27,7 +27,7 @@ import (
 	"github.com/spf13/cobra"
 
 	"github.com/docker/compose-cli/api/client"
-	"github.com/docker/compose-cli/formatter"
+	"github.com/docker/compose-cli/cli/formatter"
 )
 
 func psCommand() *cobra.Command {

+ 1 - 1
cli/cmd/compose/pull.go

@@ -23,7 +23,7 @@ import (
 	"github.com/spf13/cobra"
 
 	"github.com/docker/compose-cli/api/client"
-	"github.com/docker/compose-cli/progress"
+	"github.com/docker/compose-cli/api/progress"
 )
 
 type pullOptions struct {

+ 1 - 1
cli/cmd/compose/push.go

@@ -23,7 +23,7 @@ import (
 	"github.com/spf13/cobra"
 
 	"github.com/docker/compose-cli/api/client"
-	"github.com/docker/compose-cli/progress"
+	"github.com/docker/compose-cli/api/progress"
 )
 
 type pushOptions struct {

+ 1 - 1
cli/cmd/compose/run.go

@@ -25,7 +25,7 @@ import (
 
 	"github.com/docker/compose-cli/api/client"
 	"github.com/docker/compose-cli/api/compose"
-	"github.com/docker/compose-cli/progress"
+	"github.com/docker/compose-cli/api/progress"
 )
 
 type runOptions struct {

+ 3 - 3
cli/cmd/compose/up.go

@@ -24,9 +24,9 @@ import (
 
 	"github.com/docker/compose-cli/api/client"
 	"github.com/docker/compose-cli/api/compose"
-	"github.com/docker/compose-cli/context/store"
-	"github.com/docker/compose-cli/formatter"
-	"github.com/docker/compose-cli/progress"
+	"github.com/docker/compose-cli/api/context/store"
+	"github.com/docker/compose-cli/api/progress"
+	"github.com/docker/compose-cli/cli/formatter"
 
 	"github.com/compose-spec/compose-go/cli"
 	"github.com/compose-spec/compose-go/types"

+ 1 - 1
cli/cmd/context/create.go

@@ -23,8 +23,8 @@ import (
 
 	"github.com/spf13/cobra"
 
+	"github.com/docker/compose-cli/api/context/store"
 	"github.com/docker/compose-cli/cli/mobycli"
-	"github.com/docker/compose-cli/context/store"
 )
 
 type descriptionCreateOpts struct {

+ 2 - 2
cli/cmd/context/create_aci.go

@@ -24,8 +24,8 @@ import (
 
 	"github.com/docker/compose-cli/aci"
 	"github.com/docker/compose-cli/api/client"
-	"github.com/docker/compose-cli/context/store"
-	"github.com/docker/compose-cli/errdefs"
+	"github.com/docker/compose-cli/api/context/store"
+	"github.com/docker/compose-cli/api/errdefs"
 )
 
 func init() {

+ 5 - 4
cli/cmd/context/create_ecs.go

@@ -23,12 +23,13 @@ import (
 	"os"
 	"strings"
 
-	"github.com/docker/compose-cli/api/client"
-	"github.com/docker/compose-cli/context/store"
-	"github.com/docker/compose-cli/ecs"
-	"github.com/docker/compose-cli/errdefs"
 	"github.com/pkg/errors"
 	"github.com/spf13/cobra"
+
+	"github.com/docker/compose-cli/api/client"
+	"github.com/docker/compose-cli/api/context/store"
+	"github.com/docker/compose-cli/api/errdefs"
+	"github.com/docker/compose-cli/ecs"
 )
 
 func init() {

+ 3 - 3
cli/cmd/context/ls.go

@@ -26,10 +26,10 @@ import (
 	"github.com/pkg/errors"
 	"github.com/spf13/cobra"
 
+	apicontext "github.com/docker/compose-cli/api/context"
+	"github.com/docker/compose-cli/api/context/store"
+	"github.com/docker/compose-cli/cli/formatter"
 	"github.com/docker/compose-cli/cli/mobycli"
-	apicontext "github.com/docker/compose-cli/context"
-	"github.com/docker/compose-cli/context/store"
-	"github.com/docker/compose-cli/formatter"
 )
 
 type lsOpts struct {

+ 2 - 2
cli/cmd/context/rm.go

@@ -24,9 +24,9 @@ import (
 	"github.com/hashicorp/go-multierror"
 	"github.com/spf13/cobra"
 
+	apicontext "github.com/docker/compose-cli/api/context"
+	"github.com/docker/compose-cli/api/context/store"
 	"github.com/docker/compose-cli/cli/formatter"
-	apicontext "github.com/docker/compose-cli/context"
-	"github.com/docker/compose-cli/context/store"
 )
 
 type removeOpts struct {

+ 2 - 2
cli/cmd/context/show.go

@@ -22,8 +22,8 @@ import (
 
 	"github.com/spf13/cobra"
 
-	apicontext "github.com/docker/compose-cli/context"
-	"github.com/docker/compose-cli/context/store"
+	apicontext "github.com/docker/compose-cli/api/context"
+	"github.com/docker/compose-cli/api/context/store"
 )
 
 func showCommand() *cobra.Command {

+ 2 - 2
cli/cmd/context/update.go

@@ -20,9 +20,9 @@ import (
 	"github.com/pkg/errors"
 	"github.com/spf13/cobra"
 
+	"github.com/docker/compose-cli/api/context/store"
+	"github.com/docker/compose-cli/api/errdefs"
 	"github.com/docker/compose-cli/cli/mobycli"
-	"github.com/docker/compose-cli/context/store"
-	"github.com/docker/compose-cli/errdefs"
 )
 
 func updateCommand() *cobra.Command {

+ 2 - 2
cli/cmd/context/use.go

@@ -22,8 +22,8 @@ import (
 
 	"github.com/spf13/cobra"
 
-	"github.com/docker/compose-cli/config"
-	"github.com/docker/compose-cli/context/store"
+	"github.com/docker/compose-cli/api/config"
+	"github.com/docker/compose-cli/api/context/store"
 )
 
 func useCommand() *cobra.Command {

+ 1 - 1
cli/cmd/inspect.go

@@ -27,7 +27,7 @@ import (
 
 	"github.com/docker/compose-cli/api/client"
 	"github.com/docker/compose-cli/api/containers"
-	"github.com/docker/compose-cli/formatter"
+	"github.com/docker/compose-cli/cli/formatter"
 )
 
 // InspectCommand inspects into containers

+ 0 - 34
cli/cmd/inspect_test.go

@@ -1,34 +0,0 @@
-/*
-   Copyright 2020 Docker Compose CLI authors
-
-   Licensed under the Apache License, Version 2.0 (the "License");
-   you may not use this file except in compliance with the License.
-   You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
-*/
-
-package cmd
-
-import (
-	"testing"
-
-	"gotest.tools/v3/assert"
-	"gotest.tools/v3/golden"
-
-	_ "github.com/docker/compose-cli/example"
-	"github.com/docker/compose-cli/tests/framework"
-)
-
-func TestInspectId(t *testing.T) {
-	c := framework.NewTestCLI(t)
-	err := runInspect(c.Context(), "id")
-	assert.NilError(t, err)
-	golden.Assert(t, c.GetStdOut(), "inspect-out-id.golden")
-}

+ 1 - 1
cli/cmd/kill.go

@@ -25,8 +25,8 @@ import (
 	"github.com/spf13/cobra"
 
 	"github.com/docker/compose-cli/api/client"
+	"github.com/docker/compose-cli/api/errdefs"
 	"github.com/docker/compose-cli/cli/formatter"
-	"github.com/docker/compose-cli/errdefs"
 )
 
 type killOpts struct {

+ 1 - 1
cli/cmd/login/login.go

@@ -24,9 +24,9 @@ import (
 	"github.com/spf13/cobra"
 
 	"github.com/docker/compose-cli/api/client"
+	"github.com/docker/compose-cli/api/errdefs"
 	"github.com/docker/compose-cli/cli/cmd/mobyflags"
 	"github.com/docker/compose-cli/cli/mobycli"
-	"github.com/docker/compose-cli/errdefs"
 )
 
 // Command returns the login command

+ 1 - 1
cli/cmd/logout/azure.go

@@ -24,7 +24,7 @@ import (
 	"github.com/spf13/cobra"
 
 	"github.com/docker/compose-cli/api/client"
-	"github.com/docker/compose-cli/errdefs"
+	"github.com/docker/compose-cli/api/errdefs"
 )
 
 // AzureLogoutCommand returns the azure logout command

+ 1 - 1
cli/cmd/ps.go

@@ -28,7 +28,7 @@ import (
 
 	"github.com/docker/compose-cli/api/client"
 	"github.com/docker/compose-cli/api/containers"
-	formatter2 "github.com/docker/compose-cli/formatter"
+	formatter2 "github.com/docker/compose-cli/cli/formatter"
 	"github.com/docker/compose-cli/utils/formatter"
 )
 

+ 0 - 51
cli/cmd/ps_test.go

@@ -1,51 +0,0 @@
-/*
-   Copyright 2020 Docker Compose CLI authors
-
-   Licensed under the Apache License, Version 2.0 (the "License");
-   you may not use this file except in compliance with the License.
-   You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
-*/
-
-package cmd
-
-import (
-	"testing"
-
-	"gotest.tools/v3/assert"
-	"gotest.tools/v3/golden"
-
-	_ "github.com/docker/compose-cli/example"
-	"github.com/docker/compose-cli/tests/framework"
-)
-
-func TestPs(t *testing.T) {
-	c := framework.NewTestCLI(t)
-	opts := psOpts{
-		quiet: false,
-	}
-
-	err := runPs(c.Context(), opts)
-	assert.NilError(t, err)
-
-	golden.Assert(t, c.GetStdOut(), "ps-out.golden")
-}
-
-func TestPsQuiet(t *testing.T) {
-	c := framework.NewTestCLI(t)
-	opts := psOpts{
-		quiet: true,
-	}
-
-	err := runPs(c.Context(), opts)
-	assert.NilError(t, err)
-
-	golden.Assert(t, c.GetStdOut(), "ps-out-quiet.golden")
-}

+ 1 - 1
cli/cmd/rm.go

@@ -26,8 +26,8 @@ import (
 
 	"github.com/docker/compose-cli/api/client"
 	"github.com/docker/compose-cli/api/containers"
+	"github.com/docker/compose-cli/api/errdefs"
 	"github.com/docker/compose-cli/cli/formatter"
-	"github.com/docker/compose-cli/errdefs"
 )
 
 type rmOpts struct {

+ 2 - 2
cli/cmd/run/run.go

@@ -28,9 +28,9 @@ import (
 
 	"github.com/docker/compose-cli/api/client"
 	"github.com/docker/compose-cli/api/containers"
+	"github.com/docker/compose-cli/api/context/store"
+	"github.com/docker/compose-cli/api/progress"
 	"github.com/docker/compose-cli/cli/options/run"
-	"github.com/docker/compose-cli/context/store"
-	"github.com/docker/compose-cli/progress"
 )
 
 // Command runs a container

+ 1 - 1
cli/cmd/secrets.go

@@ -26,7 +26,7 @@ import (
 
 	"github.com/docker/compose-cli/api/client"
 	"github.com/docker/compose-cli/api/secrets"
-	"github.com/docker/compose-cli/formatter"
+	"github.com/docker/compose-cli/cli/formatter"
 )
 
 // SecretCommand manage secrets

+ 7 - 7
cli/cmd/serve.go

@@ -23,13 +23,13 @@ import (
 	"github.com/sirupsen/logrus"
 	"github.com/spf13/cobra"
 
-	composev1 "github.com/docker/compose-cli/protos/compose/v1"
-	containersv1 "github.com/docker/compose-cli/protos/containers/v1"
-	contextsv1 "github.com/docker/compose-cli/protos/contexts/v1"
-	streamsv1 "github.com/docker/compose-cli/protos/streams/v1"
-	volumesv1 "github.com/docker/compose-cli/protos/volumes/v1"
-	"github.com/docker/compose-cli/server"
-	"github.com/docker/compose-cli/server/proxy"
+	"github.com/docker/compose-cli/cli/server"
+	composev1 "github.com/docker/compose-cli/cli/server/protos/compose/v1"
+	containersv1 "github.com/docker/compose-cli/cli/server/protos/containers/v1"
+	contextsv1 "github.com/docker/compose-cli/cli/server/protos/contexts/v1"
+	streamsv1 "github.com/docker/compose-cli/cli/server/protos/streams/v1"
+	volumesv1 "github.com/docker/compose-cli/cli/server/protos/volumes/v1"
+	"github.com/docker/compose-cli/cli/server/proxy"
 )
 
 type serveOpts struct {

+ 1 - 1
cli/cmd/start.go

@@ -25,8 +25,8 @@ import (
 	"github.com/spf13/cobra"
 
 	"github.com/docker/compose-cli/api/client"
+	"github.com/docker/compose-cli/api/errdefs"
 	"github.com/docker/compose-cli/cli/formatter"
-	"github.com/docker/compose-cli/errdefs"
 )
 
 // StartCommand starts containers

+ 1 - 1
cli/cmd/stop.go

@@ -25,8 +25,8 @@ import (
 	"github.com/spf13/cobra"
 
 	"github.com/docker/compose-cli/api/client"
+	"github.com/docker/compose-cli/api/errdefs"
 	"github.com/docker/compose-cli/cli/formatter"
-	"github.com/docker/compose-cli/errdefs"
 )
 
 type stopOpts struct {

+ 0 - 14
cli/cmd/testdata/inspect-out-id.golden

@@ -1,14 +0,0 @@
-{
-    "ID": "id",
-    "Status": "",
-    "Image": "nginx",
-    "HostConfig": {
-        "RestartPolicy": "none",
-        "CPUReservation": 0,
-        "CPULimit": 0,
-        "MemoryReservation": 0,
-        "MemoryLimit": 0,
-        "AutoRemove": false
-    },
-    "Platform": "Linux"
-}

+ 0 - 2
cli/cmd/testdata/ps-out-quiet.golden

@@ -1,2 +0,0 @@
-id
-1234

+ 0 - 3
cli/cmd/testdata/ps-out.golden

@@ -1,3 +0,0 @@
-CONTAINER ID        IMAGE               COMMAND             STATUS              PORTS
-id                  nginx                                                       
-1234                alpine                                                      

+ 1 - 1
cli/cmd/version.go

@@ -24,8 +24,8 @@ import (
 	"github.com/spf13/cobra"
 
 	"github.com/docker/compose-cli/cli/cmd/mobyflags"
+	"github.com/docker/compose-cli/cli/formatter"
 	"github.com/docker/compose-cli/cli/mobycli"
-	"github.com/docker/compose-cli/formatter"
 	"github.com/docker/compose-cli/internal"
 )
 

+ 3 - 3
cli/cmd/volume/command.go

@@ -22,11 +22,11 @@ import (
 
 	"github.com/docker/compose-cli/aci"
 	"github.com/docker/compose-cli/api/client"
+	"github.com/docker/compose-cli/api/context/store"
+	"github.com/docker/compose-cli/api/progress"
 	"github.com/docker/compose-cli/cli/formatter"
-	"github.com/docker/compose-cli/context/store"
+	formatter2 "github.com/docker/compose-cli/cli/formatter"
 	"github.com/docker/compose-cli/ecs"
-	formatter2 "github.com/docker/compose-cli/formatter"
-	"github.com/docker/compose-cli/progress"
 
 	"github.com/hashicorp/go-multierror"
 	"github.com/spf13/cobra"

+ 1 - 1
cli/cmd/volume/list.go

@@ -25,7 +25,7 @@ import (
 
 	"github.com/docker/compose-cli/api/client"
 	"github.com/docker/compose-cli/api/volumes"
-	"github.com/docker/compose-cli/formatter"
+	"github.com/docker/compose-cli/cli/formatter"
 )
 
 type listVolumeOpts struct {

+ 1 - 1
cli/config/flags.go

@@ -22,7 +22,7 @@ import (
 
 	"github.com/spf13/pflag"
 
-	"github.com/docker/compose-cli/config"
+	"github.com/docker/compose-cli/api/config"
 )
 
 // ConfigFlags are the global CLI flags

+ 0 - 0
formatter/colors.go → cli/formatter/colors.go


+ 0 - 0
formatter/consts.go → cli/formatter/consts.go


+ 1 - 1
formatter/formatter.go → cli/formatter/formatter.go

@@ -24,7 +24,7 @@ import (
 
 	"github.com/pkg/errors"
 
-	"github.com/docker/compose-cli/errdefs"
+	"github.com/docker/compose-cli/api/errdefs"
 )
 
 // Print prints formatted lists in different formats

+ 0 - 0
formatter/formatter_test.go → cli/formatter/formatter_test.go


+ 0 - 0
formatter/json.go → cli/formatter/json.go


+ 0 - 0
formatter/logs.go → cli/formatter/logs.go


+ 0 - 0
formatter/pretty.go → cli/formatter/pretty.go


+ 5 - 5
cli/main.go

@@ -32,6 +32,10 @@ import (
 	"github.com/sirupsen/logrus"
 	"github.com/spf13/cobra"
 
+	"github.com/docker/compose-cli/api/config"
+	apicontext "github.com/docker/compose-cli/api/context"
+	"github.com/docker/compose-cli/api/context/store"
+	"github.com/docker/compose-cli/api/errdefs"
 	"github.com/docker/compose-cli/cli/cmd"
 	"github.com/docker/compose-cli/cli/cmd/compose"
 	contextcmd "github.com/docker/compose-cli/cli/cmd/context"
@@ -39,13 +43,9 @@ import (
 	"github.com/docker/compose-cli/cli/cmd/logout"
 	"github.com/docker/compose-cli/cli/cmd/run"
 	"github.com/docker/compose-cli/cli/cmd/volume"
+	"github.com/docker/compose-cli/cli/metrics"
 	"github.com/docker/compose-cli/cli/mobycli"
 	cliopts "github.com/docker/compose-cli/cli/options"
-	"github.com/docker/compose-cli/config"
-	apicontext "github.com/docker/compose-cli/context"
-	"github.com/docker/compose-cli/context/store"
-	"github.com/docker/compose-cli/errdefs"
-	"github.com/docker/compose-cli/metrics"
 
 	// Backend registrations
 	_ "github.com/docker/compose-cli/aci"

+ 1 - 1
cli/main_test.go

@@ -24,11 +24,11 @@ import (
 
 	"gotest.tools/v3/assert"
 
+	"github.com/docker/compose-cli/api/config"
 	"github.com/docker/compose-cli/cli/cmd"
 	"github.com/docker/compose-cli/cli/cmd/context"
 	"github.com/docker/compose-cli/cli/cmd/login"
 	"github.com/docker/compose-cli/cli/cmd/run"
-	"github.com/docker/compose-cli/config"
 )
 
 var contextSetConfig = []byte(`{

+ 0 - 0
metrics/client.go → cli/metrics/client.go


+ 0 - 0
metrics/commands.go → cli/metrics/commands.go


+ 0 - 0
metrics/conn_e2e.go → cli/metrics/conn_e2e.go


+ 0 - 0
metrics/conn_other.go → cli/metrics/conn_other.go


+ 0 - 0
metrics/conn_windows.go → cli/metrics/conn_windows.go


+ 0 - 0
metrics/generatecommands/main.go → cli/metrics/generatecommands/main.go


+ 0 - 0
metrics/metrics.go → cli/metrics/metrics.go


+ 0 - 0
metrics/metrics_test.go → cli/metrics/metrics_test.go


+ 3 - 3
cli/mobycli/exec.go

@@ -26,10 +26,10 @@ import (
 
 	"github.com/spf13/cobra"
 
+	apicontext "github.com/docker/compose-cli/api/context"
+	"github.com/docker/compose-cli/api/context/store"
+	"github.com/docker/compose-cli/cli/metrics"
 	"github.com/docker/compose-cli/cli/mobycli/resolvepath"
-	apicontext "github.com/docker/compose-cli/context"
-	"github.com/docker/compose-cli/context/store"
-	"github.com/docker/compose-cli/metrics"
 )
 
 var delegatedContextTypes = []string{store.DefaultContextType}

+ 1 - 1
cli/mobycli/exec_test.go

@@ -21,7 +21,7 @@ import (
 
 	"gotest.tools/v3/assert"
 
-	"github.com/docker/compose-cli/context/store"
+	"github.com/docker/compose-cli/api/context/store"
 )
 
 func TestDelegateContextTypeToMoby(t *testing.T) {

Some files were not shown because too many files changed in this diff