Skip to content

Commit

Permalink
Validate create api flags
Browse files Browse the repository at this point in the history
  • Loading branch information
fraenkel committed Aug 12, 2018
1 parent 581c0cb commit a7a5650
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions cmd/kubebuilder/v1/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,25 @@ func (o *apiOptions) RunAddAPI() {
fmt.Println("Create Resource under pkg/apis [y/n]?")
o.doResource = util.Yesno(reader)
}

if !o.controllerFlag.Changed {
fmt.Println("Create Controller under pkg/controller [y/n]?")
o.doController = util.Yesno(reader)
}
if o.doController {
if o.r.Kind == "" {
log.Fatalf("Must specify --kind")
}
}

if o.doResource || o.doController {
if o.r.Group == "" {
log.Fatalf("Must specify --group")
}
if o.r.Version == "" {
log.Fatalf("Must specify --version")
}
}

fmt.Println("Writing scaffold for you to edit...")

Expand Down

0 comments on commit a7a5650

Please sign in to comment.