Skip to content

Commit

Permalink
chore: Add version information of eventing (#495)
Browse files Browse the repository at this point in the history
* chore: Add version information of eventing

Adding sources.eventing.knative.dev to version info (the only eventing API)
for now as this will be the first one used.

* chore(version): Add grouping for API versions
  • Loading branch information
rhuss authored and knative-prow-robot committed Nov 19, 2019
1 parent d116fb9 commit 4879726
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
18 changes: 14 additions & 4 deletions pkg/kn/commands/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,13 @@ var BuildDate string
var GitRevision string

// update this var as we add more deps
var apiVersions = []string{
"serving.knative.dev/v1alpha1 (knative-serving v0.10.0)",
var apiVersions = map[string][]string{
"serving": {
"serving.knative.dev/v1alpha1 (knative-serving v0.10.0)",
},
"eventing": {
"sources.eventing.knative.dev/v1alpha1 (knative-eventing v0.10.0)",
},
}

// NewVersionCommand implements 'kn version' command
Expand All @@ -42,8 +47,13 @@ func NewVersionCommand(p *commands.KnParams) *cobra.Command {
fmt.Fprintf(out, "Build Date: %s\n", BuildDate)
fmt.Fprintf(out, "Git Revision: %s\n", GitRevision)
fmt.Fprintf(out, "Supported APIs:\n")
for _, api := range apiVersions {
fmt.Fprintf(out, "- %s\n", api)
fmt.Fprintf(out, "* Serving\n")
for _, api := range apiVersions["serving"] {
fmt.Fprintf(out, " - %s\n", api)
}
fmt.Fprintf(out, "* Eventing\n")
for _, api := range apiVersions["eventing"] {
fmt.Fprintf(out, " - %s\n", api)
}
},
}
Expand Down
5 changes: 4 additions & 1 deletion pkg/kn/commands/version/version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ var versionOutputTemplate = `Version: {{.Version}}
Build Date: {{.BuildDate}}
Git Revision: {{.GitRevision}}
Supported APIs:
- serving.knative.dev/v1alpha1 (knative-serving v0.10.0)
* Serving
- serving.knative.dev/v1alpha1 (knative-serving v0.10.0)
* Eventing
- sources.eventing.knative.dev/v1alpha1 (knative-eventing v0.10.0)
`

const (
Expand Down

0 comments on commit 4879726

Please sign in to comment.