Skip to content

Commit

Permalink
Merge pull request #48 from pwittrock/pluralkind
Browse files Browse the repository at this point in the history
Disallow pluralized Kinds when creating resources
  • Loading branch information
Phillip Wittrock authored Apr 3, 2018
2 parents 135624d + 7c5dcef commit f6d0548
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cmd/kubebuilder/create/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ package util

import (
"log"
"path/filepath"
"regexp"
"strings"

"github.com/markbates/inflect"
"github.com/spf13/cobra"

"github.com/kubernetes-sigs/kubebuilder/cmd/kubebuilder/util"
"path/filepath"
)

var (
Expand All @@ -44,6 +44,9 @@ func ValidateResourceFlags() {
log.Fatal("Must specify --kind")
}
if len(ResourceName) == 0 {
if inflect.NewDefaultRuleset().Pluralize(KindName) == KindName {
log.Fatal("Client code generation expects singular --kind.")
}
ResourceName = inflect.NewDefaultRuleset().Pluralize(strings.ToLower(KindName))
}

Expand Down

0 comments on commit f6d0548

Please sign in to comment.