@@ -36,20 +36,24 @@ const DefaultOutputDir = "output-dir"
36
36
func (opts * MigrateOptions ) Rescaffold () error {
37
37
config := yaml .New (machinery.Filesystem {FS : afero .NewOsFs ()})
38
38
if err := config .LoadFrom (opts .InputDir ); err != nil {
39
- log .Fatal ( err )
39
+ log .Fatalf ( "Failed to load PROJECT file %v" , err )
40
40
}
41
41
// create output directory
42
42
// nolint: gosec
43
43
if err := os .MkdirAll (opts .OutputDir , 0755 ); err != nil {
44
- log .Fatal ( err )
44
+ log .Fatalf ( "Failed to create output directory %v" , err )
45
45
}
46
46
// use the new directory to set up the new project
47
47
if err := os .Chdir (opts .OutputDir ); err != nil {
48
- log .Fatal ( err )
48
+ log .Fatalf ( "Failed to change the current working directory %v" , err )
49
49
}
50
50
// init project with plugins
51
51
if err := kubebuilderInit (config ); err != nil {
52
- log .Fatal (err )
52
+ log .Fatalf ("Failed to run init subcommand %v" , err )
53
+ }
54
+ // call edit subcommands to enable or disable multigroup layout
55
+ if err := kubebuilderEdit (config ); err != nil {
56
+ log .Fatalf ("Failed to run edit subcommand %v" , err )
53
57
}
54
58
return nil
55
59
}
@@ -107,6 +111,14 @@ func kubebuilderInit(store store.Store) error {
107
111
return util .RunCmd ("kubebuilder init" , "kubebuilder" , args ... )
108
112
}
109
113
114
+ func kubebuilderEdit (store store.Store ) error {
115
+ if store .Config ().IsMultiGroup () {
116
+ args := []string {"edit" , "--multigroup" }
117
+ return util .RunCmd ("kubebuilder edit" , "kubebuilder" , args ... )
118
+ }
119
+ return nil
120
+ }
121
+
110
122
func getInitArgs (store store.Store ) []string {
111
123
var args []string
112
124
plugins := store .Config ().GetPluginChain ()
0 commit comments