move compose-plugin commands under /cmd

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
Nicolas De Loof 2021-06-15 08:48:49 +02:00
parent d90495e1cd
commit e2ea24ceb7
32 changed files with 17 additions and 17 deletions

View File

@ -55,7 +55,7 @@ cli:
.PHONY: compose-plugin .PHONY: compose-plugin
compose-plugin: compose-plugin:
GOOS=${GOOS} GOARCH=${GOARCH} $(GO_BUILD) $(TAGS) -o $(COMPOSE_BINARY_WITH_EXTENSION) . GOOS=${GOOS} GOARCH=${GOARCH} $(GO_BUILD) $(TAGS) -o $(COMPOSE_BINARY_WITH_EXTENSION) ./cmd
.PHONY: cross .PHONY: cross
cross: cross:
@ -69,13 +69,13 @@ cross:
.PHONY: cross-compose-plugin .PHONY: cross-compose-plugin
cross-compose-plugin: cross-compose-plugin:
GOOS=linux GOARCH=amd64 $(GO_BUILD) $(TAGS) -o $(COMPOSE_BINARY)-linux-amd64 . GOOS=linux GOARCH=amd64 $(GO_BUILD) $(TAGS) -o $(COMPOSE_BINARY)-linux-amd64 ./cmd
GOOS=linux GOARCH=arm64 $(GO_BUILD) $(TAGS) -o $(COMPOSE_BINARY)-linux-arm64 . GOOS=linux GOARCH=arm64 $(GO_BUILD) $(TAGS) -o $(COMPOSE_BINARY)-linux-arm64 ./cmd
GOOS=linux GOARM=6 GOARCH=arm $(GO_BUILD) $(TAGS) -o $(COMPOSE_BINARY)-linux-armv6 . GOOS=linux GOARM=6 GOARCH=arm $(GO_BUILD) $(TAGS) -o $(COMPOSE_BINARY)-linux-armv6 ./cmd
GOOS=linux GOARM=7 GOARCH=arm $(GO_BUILD) $(TAGS) -o $(COMPOSE_BINARY)-linux-armv7 . GOOS=linux GOARM=7 GOARCH=arm $(GO_BUILD) $(TAGS) -o $(COMPOSE_BINARY)-linux-armv7 ./cmd
GOOS=darwin GOARCH=amd64 $(GO_BUILD) $(TAGS) -o $(COMPOSE_BINARY)-darwin-amd64 . GOOS=darwin GOARCH=amd64 $(GO_BUILD) $(TAGS) -o $(COMPOSE_BINARY)-darwin-amd64 ./cmd
GOOS=darwin GOARCH=arm64 $(GO_BUILD) $(TAGS) -o $(COMPOSE_BINARY)-darwin-arm64 . GOOS=darwin GOARCH=arm64 $(GO_BUILD) $(TAGS) -o $(COMPOSE_BINARY)-darwin-arm64 ./cmd
GOOS=windows GOARCH=amd64 $(GO_BUILD) $(TAGS) -o $(COMPOSE_BINARY)-windows-amd64.exe . GOOS=windows GOARCH=amd64 $(GO_BUILD) $(TAGS) -o $(COMPOSE_BINARY)-windows-amd64.exe ./cmd
.PHONY: test .PHONY: test
test: test:

View File

@ -39,7 +39,6 @@ import (
apicontext "github.com/docker/compose-cli/api/context" apicontext "github.com/docker/compose-cli/api/context"
"github.com/docker/compose-cli/api/context/store" "github.com/docker/compose-cli/api/context/store"
"github.com/docker/compose-cli/cli/cmd" "github.com/docker/compose-cli/cli/cmd"
"github.com/docker/compose-cli/cli/cmd/compose"
contextcmd "github.com/docker/compose-cli/cli/cmd/context" contextcmd "github.com/docker/compose-cli/cli/cmd/context"
"github.com/docker/compose-cli/cli/cmd/login" "github.com/docker/compose-cli/cli/cmd/login"
"github.com/docker/compose-cli/cli/cmd/logout" "github.com/docker/compose-cli/cli/cmd/logout"
@ -49,8 +48,9 @@ import (
"github.com/docker/compose-cli/cli/metrics" "github.com/docker/compose-cli/cli/metrics"
"github.com/docker/compose-cli/cli/mobycli" "github.com/docker/compose-cli/cli/mobycli"
cliopts "github.com/docker/compose-cli/cli/options" cliopts "github.com/docker/compose-cli/cli/options"
compose2 "github.com/docker/compose-cli/cmd/compose"
"github.com/docker/compose-cli/local" "github.com/docker/compose-cli/local"
api "github.com/docker/compose-cli/pkg/api" "github.com/docker/compose-cli/pkg/api"
// Backend registrations // Backend registrations
_ "github.com/docker/compose-cli/aci" _ "github.com/docker/compose-cli/aci"
@ -225,7 +225,7 @@ func main() {
if ctype != store.DefaultContextType { if ctype != store.DefaultContextType {
// On default context, "compose" is implemented by CLI Plugin // On default context, "compose" is implemented by CLI Plugin
proxy := api.NewServiceProxy().WithService(service.ComposeService()) proxy := api.NewServiceProxy().WithService(service.ComposeService())
command := compose.RootCommand(ctype, proxy) command := compose2.RootCommand(ctype, proxy)
if ctype == store.AciContextType { if ctype == store.AciContextType {
customizeCliForACI(command, proxy) customizeCliForACI(command, proxy)
@ -315,9 +315,9 @@ func exit(ctx string, err error, ctype string) {
os.Exit(api.ExitCodeLoginRequired) os.Exit(api.ExitCodeLoginRequired)
} }
if compose.Warning != "" { if compose2.Warning != "" {
logrus.Warn(err) logrus.Warn(err)
fmt.Fprintln(os.Stderr, compose.Warning) fmt.Fprintln(os.Stderr, compose2.Warning)
} }
if errors.Is(err, api.ErrNotImplemented) { if errors.Is(err, api.ErrNotImplemented) {

View File

@ -26,17 +26,17 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
"github.com/docker/compose-cli/api/context/store" "github.com/docker/compose-cli/api/context/store"
"github.com/docker/compose-cli/cli/cmd/compose"
"github.com/docker/compose-cli/cli/metrics" "github.com/docker/compose-cli/cli/metrics"
commands "github.com/docker/compose-cli/cmd/compose"
"github.com/docker/compose-cli/internal" "github.com/docker/compose-cli/internal"
impl "github.com/docker/compose-cli/local/compose" impl "github.com/docker/compose-cli/local/compose"
api "github.com/docker/compose-cli/pkg/api" "github.com/docker/compose-cli/pkg/api"
) )
func main() { func main() {
plugin.Run(func(dockerCli command.Cli) *cobra.Command { plugin.Run(func(dockerCli command.Cli) *cobra.Command {
lazyInit := api.NewServiceProxy() lazyInit := api.NewServiceProxy()
cmd := compose.RootCommand(store.DefaultContextType, lazyInit) cmd := commands.RootCommand(store.DefaultContextType, lazyInit)
originalPreRun := cmd.PersistentPreRunE originalPreRun := cmd.PersistentPreRunE
cmd.PersistentPreRunE = func(cmd *cobra.Command, args []string) error { cmd.PersistentPreRunE = func(cmd *cobra.Command, args []string) error {
if err := plugin.PersistentPreRunE(cmd, args); err != nil { if err := plugin.PersistentPreRunE(cmd, args); err != nil {

View File

@ -27,7 +27,7 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
"github.com/spf13/pflag" "github.com/spf13/pflag"
"github.com/docker/compose-cli/cli/cmd/compose" "github.com/docker/compose-cli/cmd/compose"
. "github.com/docker/compose-cli/docs/yaml" . "github.com/docker/compose-cli/docs/yaml"
) )