Skip to content

Commit 1a4f851

Browse files
cleanup/refactory : Re-Generate Alpha Command
refactor: improve error handling, encapsulate logic, and streamline flow in rescaffold command move code implementation from pkg to CLI since it is a command
1 parent b4e57ed commit 1a4f851

File tree

2 files changed

+157
-126
lines changed

2 files changed

+157
-126
lines changed

pkg/cli/alpha/generate.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ package alpha
1515

1616
import (
1717
log "github.com/sirupsen/logrus"
18+
"sigs.k8s.io/kubebuilder/v4/pkg/cli"
1819

1920
"github.com/spf13/cobra"
20-
"sigs.k8s.io/kubebuilder/v4/pkg/rescaffold"
2121
)
2222

2323
// NewScaffoldCommand return a new scaffold command
2424
func NewScaffoldCommand() *cobra.Command {
25-
opts := rescaffold.MigrateOptions{}
25+
opts := cli.ReGenerate{}
2626
scaffoldCmd := &cobra.Command{
2727
Use: "generate",
2828
Short: "Re-scaffold an existing Kuberbuilder project",
@@ -36,8 +36,8 @@ Then we will re-scaffold the project by Kubebuilder in the directory specified b
3636
return opts.Validate()
3737
},
3838
Run: func(_ *cobra.Command, _ []string) {
39-
if err := opts.Rescaffold(); err != nil {
40-
log.Fatalf("Failed to rescaffold %s", err)
39+
if err := opts.Generate(); err != nil {
40+
log.Fatalf("Failed to command %s", err)
4141
}
4242
},
4343
}

0 commit comments

Comments
 (0)