From 4e35474de4d7fd7f2e13e90b98d6bb2a7829181c Mon Sep 17 00:00:00 2001 From: KK <68334452+healthjyk@users.noreply.github.com> Date: Wed, 28 Feb 2024 15:54:28 +0800 Subject: [PATCH] chore: clear deprecated kusion compile (#834) --- pkg/cmd/cmd.go | 3 --- pkg/cmd/compile/compile.go | 30 ------------------------------ pkg/cmd/compile/compile_test.go | 15 --------------- 3 files changed, 48 deletions(-) delete mode 100644 pkg/cmd/compile/compile.go delete mode 100644 pkg/cmd/compile/compile_test.go diff --git a/pkg/cmd/cmd.go b/pkg/cmd/cmd.go index 889625d3..a1d03d00 100644 --- a/pkg/cmd/cmd.go +++ b/pkg/cmd/cmd.go @@ -14,8 +14,6 @@ import ( cmdinit "kusionstack.io/kusion/pkg/cmd/init" "kusionstack.io/kusion/pkg/cmd/workspace" - // we need to import compile pkg to keep the compile command available - "kusionstack.io/kusion/pkg/cmd/compile" //nolint:staticcheck "kusionstack.io/kusion/pkg/cmd/destroy" "kusionstack.io/kusion/pkg/cmd/preview" "kusionstack.io/kusion/pkg/cmd/version" @@ -94,7 +92,6 @@ func NewKusionctlCmd(o KusionctlOptions) *cobra.Command { Commands: []*cobra.Command{ workspace.NewCmd(), cmdinit.NewCmdInit(), - compile.NewCmdCompile(), build.NewCmdBuild(), }, }, diff --git a/pkg/cmd/compile/compile.go b/pkg/cmd/compile/compile.go deleted file mode 100644 index 05f26492..00000000 --- a/pkg/cmd/compile/compile.go +++ /dev/null @@ -1,30 +0,0 @@ -// Deprecated: Use Build to generate the Intent instead. -package compile - -import ( - "fmt" - - "github.com/spf13/cobra" - "k8s.io/kubectl/pkg/util/templates" - - "kusionstack.io/kusion/pkg/cmd/util" - "kusionstack.io/kusion/pkg/util/i18n" -) - -func NewCmdCompile() *cobra.Command { - compileShort := i18n.T("Deprecated: Use 'kusion build' to generate the Intent instead") - compileExample := i18n.T("Deprecated") - - cmd := &cobra.Command{ - Use: "compile", - Short: compileShort, - Example: templates.Examples(compileExample), - Aliases: []string{"cl"}, - RunE: func(_ *cobra.Command, args []string) (err error) { - defer util.RecoverErr(&err) - util.CheckErr(fmt.Errorf("this command is deprecated. Please use `kusion build` to generate the Intent instead")) - return - }, - } - return cmd -} diff --git a/pkg/cmd/compile/compile_test.go b/pkg/cmd/compile/compile_test.go deleted file mode 100644 index 902acf0d..00000000 --- a/pkg/cmd/compile/compile_test.go +++ /dev/null @@ -1,15 +0,0 @@ -package compile - -import ( - "testing" - - "github.com/stretchr/testify/assert" -) - -func TestNewCmdCompile(t *testing.T) { - t.Run("compile", func(t *testing.T) { - cmd := NewCmdCompile() - err := cmd.Execute() - assert.Errorf(t, err, "this command is deprecated. Please use `kusion build` to generate the Intent instead") - }) -}