You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: commands/operator-sdk/cmd/new.go
+11-2Lines changed: 11 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -15,6 +15,7 @@
15
15
package cmd
16
16
17
17
import (
18
+
"errors"
18
19
"fmt"
19
20
"os"
20
21
"os/exec"
@@ -41,7 +42,7 @@ generates a default directory layout based on the input <project-name>.
41
42
For example:
42
43
$ mkdir $GOPATH/src/github.com/example.com/
43
44
$ cd $GOPATH/src/github.com/example.com/
44
-
$ operator-sdk new app-operator --api-group=app.example.com --kind=AppService
45
+
$ operator-sdk new app-operator --api-group=app.example.com/v1alpha1 --kind=AppService
45
46
generates a skeletal app-operator application in $GOPATH/src/github.com/example.com/app-operator.
46
47
`,
47
48
Run: newFunc,
@@ -124,7 +125,15 @@ func repoPath() string {
124
125
}
125
126
126
127
funcverifyFlags() {
127
-
// TODO: verify format of input flags.
128
+
iflen(apiVersion) ==0 {
129
+
cmdError.ExitWithError(cmdError.ExitBadArgs, errors.New("--api-version must not have empty value"))
130
+
}
131
+
iflen(kind) ==0 {
132
+
cmdError.ExitWithError(cmdError.ExitBadArgs, errors.New("--kind must not have empty value"))
133
+
}
134
+
ifstrings.Count(apiVersion, "/") !=1 {
135
+
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))
0 commit comments