We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a017658 commit 30753f9Copy full SHA for 30753f9
cmd/kubectl-tree/rootcmd.go
@@ -44,7 +44,17 @@ var rootCmd = &cobra.Command{
44
" kubectl tree kservice.v1.serving.knative.dev my-app", // TODO add more examples about disambiguation etc
45
Args: cobra.MinimumNArgs(2),
46
RunE: run,
47
- Version: version,
+ Version: versionString(),
48
+}
49
+
50
+// versionString returns the version prefixed by 'v'
51
+// or an empty string if no version has been populated by goreleaser.
52
+// In this case, the --version flag will not be added by cobra.
53
+func versionString() string {
54
+ if len(version) == 0 {
55
+ return ""
56
+ }
57
+ return "v" + version
58
}
59
60
func run(_ *cobra.Command, args []string) error {
0 commit comments