Skip to content

Commit

Permalink
✨ Add the validation for edit command
Browse files Browse the repository at this point in the history
  • Loading branch information
prafull01 committed Oct 29, 2020
1 parent 70108bf commit 65a3717
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pkg/plugin/v3/edit.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"github.com/spf13/pflag"

"sigs.k8s.io/kubebuilder/internal/cmdutil"
internalconfig "sigs.k8s.io/kubebuilder/internal/config"
"sigs.k8s.io/kubebuilder/pkg/model/config"
"sigs.k8s.io/kubebuilder/pkg/plugin"
"sigs.k8s.io/kubebuilder/pkg/plugin/scaffold"
Expand Down Expand Up @@ -67,6 +68,14 @@ func (p *editPlugin) Run() error {
}

func (p *editPlugin) Validate() error {
config, err := internalconfig.Load()
if err != nil {
return err
}

if p.multigroup == config.MultiGroup {
return fmt.Errorf("project scaffolding is already on multigroup:%v", config.MultiGroup)
}
return nil
}

Expand Down

0 comments on commit 65a3717

Please sign in to comment.