@@ -25,7 +25,7 @@ import (
25
25
"sigs.k8s.io/kubebuilder/v2/pkg/plugin"
26
26
)
27
27
28
- func (c * cli ) newCreateAPICmd () * cobra.Command {
28
+ func (c cli ) newCreateAPICmd () * cobra.Command {
29
29
ctx := c .newAPIContext ()
30
30
cmd := & cobra.Command {
31
31
Use : "api" ,
@@ -43,19 +43,20 @@ func (c *cli) newCreateAPICmd() *cobra.Command {
43
43
}
44
44
45
45
func (c cli ) newAPIContext () plugin.Context {
46
- ctx := plugin.Context {
46
+ return plugin.Context {
47
47
CommandName : c .commandName ,
48
48
Description : `Scaffold a Kubernetes API.
49
49
` ,
50
50
}
51
- if ! c .configured {
52
- ctx .Description = fmt .Sprintf ("%s\n %s" , ctx .Description , runInProjectRootMsg )
53
- }
54
- return ctx
55
51
}
56
52
57
53
// nolint:dupl
58
54
func (c cli ) bindCreateAPI (ctx plugin.Context , cmd * cobra.Command ) {
55
+ if len (c .resolvedPlugins ) == 0 {
56
+ cmdErr (cmd , fmt .Errorf (noPluginError ))
57
+ return
58
+ }
59
+
59
60
var createAPIPlugin plugin.CreateAPI
60
61
for _ , p := range c .resolvedPlugins {
61
62
tmpPlugin , isValid := p .(plugin.CreateAPI )
@@ -71,8 +72,7 @@ func (c cli) bindCreateAPI(ctx plugin.Context, cmd *cobra.Command) {
71
72
}
72
73
73
74
if createAPIPlugin == nil {
74
- err := fmt .Errorf ("relevant plugins do not provide an API creation plugin" )
75
- cmdErr (cmd , err )
75
+ cmdErr (cmd , fmt .Errorf ("resolved plugins do not provide an API creation plugin: %v" , c .pluginKeys ))
76
76
return
77
77
}
78
78
0 commit comments