File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,7 +10,6 @@ import (
1010 "github.com/loft-sh/vcluster/cmd/vcluster/cmd/debug"
1111 "github.com/loft-sh/vcluster/cmd/vcluster/cmd/node"
1212 "github.com/loft-sh/vcluster/cmd/vcluster/cmd/snapshot"
13- "github.com/loft-sh/vcluster/pkg/telemetry"
1413 "github.com/loft-sh/vcluster/pkg/util/osutil"
1514 "github.com/spf13/cobra"
1615 "k8s.io/klog/v2"
@@ -65,11 +64,9 @@ func RunRoot() {
6564func BuildRoot () * cobra.Command {
6665 rootCmd := NewRootCmd ()
6766
68- // Set version for --version flag
69- rootCmd .Version = telemetry .SyncerVersion
70-
7167 // add top level commands
7268 rootCmd .AddCommand (NewStartCommand ())
69+ rootCmd .AddCommand (NewVersionCommand ())
7370 rootCmd .AddCommand (snapshot .NewSnapshotCommand ())
7471 rootCmd .AddCommand (snapshot .NewRestoreCommand ())
7572 rootCmd .AddCommand (NewPortForwardCommand ())
Original file line number Diff line number Diff line change 1515func NewRestoreCommand () * cobra.Command {
1616 cmd := & cobra.Command {
1717 Use : "restore" ,
18- Short : "restore a vCluster" ,
18+ Short : "Restore a vCluster" ,
1919 Args : cobra .NoArgs ,
2020 RunE : func (cmd * cobra.Command , _ []string ) error {
2121 envOptions , err := snapshot .ParseOptionsFromEnv ()
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ import (
1010func NewSnapshotCommand () * cobra.Command {
1111 cmd := & cobra.Command {
1212 Use : "snapshot" ,
13- Short : "snapshot a vCluster" ,
13+ Short : "Manage vCluster snapshots " ,
1414 Args : cobra .NoArgs ,
1515 RunE : func (cmd * cobra.Command , _ []string ) error {
1616 client := & snapshot.Client {}
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ func NewStartCommand() *cobra.Command {
3636 startOptions := & StartOptions {}
3737 cmd := & cobra.Command {
3838 Use : "start" ,
39- Short : "Execute the vcluster " ,
39+ Short : "Start a vCluster " ,
4040 Args : cobra .NoArgs ,
4141 RunE : func (cobraCmd * cobra.Command , _ []string ) (err error ) {
4242 // execute command
Original file line number Diff line number Diff line change 1+ package cmd
2+
3+ import (
4+ "fmt"
5+
6+ "github.com/loft-sh/vcluster/pkg/telemetry"
7+
8+ "github.com/spf13/cobra"
9+ )
10+
11+ func NewVersionCommand () * cobra.Command {
12+ return & cobra.Command {
13+ Use : "version" ,
14+ Short : "Print the vCluster version" ,
15+ Args : cobra .NoArgs ,
16+ Run : func (cmd * cobra.Command , args []string ) {
17+ fmt .Fprintln (cmd .OutOrStdout (), telemetry .SyncerVersion )
18+ },
19+ }
20+ }
Original file line number Diff line number Diff line change 66
77var versionCmd = & cobra.Command {
88 Use : "version" ,
9- Short : "Print the version number of vcluster" ,
10- Long : `All software has versions. This is Vcluster's.` ,
9+ Short : "Print the vCluster version" ,
1110 Run : func (cmd * cobra.Command , _ []string ) {
1211 root := cmd .Root ()
1312 root .SetArgs ([]string {"--version" })
You can’t perform that action at this time.
0 commit comments