Skip to content

Commit

Permalink
commands/operator-sdk/cmd: Add kind uppercase check
Browse files Browse the repository at this point in the history
Fix #300 

* Add kind uppercase check

* Formatting and simplification
  • Loading branch information
theishshah authored Jul 5, 2018
1 parent c3f0c8e commit ec322ba
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions commands/operator-sdk/cmd/new.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ func verifyFlags() {
if len(kind) == 0 {
cmdError.ExitWithError(cmdError.ExitBadArgs, errors.New("--kind must not have empty value"))
}
kindFirstLetter := string(kind[0])
if kindFirstLetter != strings.ToUpper(kindFirstLetter) {
cmdError.ExitWithError(cmdError.ExitBadArgs, errors.New("--kind must start with an uppercase letter"))
}
if strings.Count(apiVersion, "/") != 1 {
cmdError.ExitWithError(cmdError.ExitBadArgs, fmt.Errorf("api-version has wrong format (%v); format must be $GROUP_NAME/$VERSION (e.g app.example.com/v1alpha1)", apiVersion))
}
Expand Down

0 comments on commit ec322ba

Please sign in to comment.