Skip to content

Commit a3dd6ea

Browse files
added version command to know the devspace version
1 parent 336b4d2 commit a3dd6ea

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

cmd/root.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ Additional run commands:
258258
rootCmd.AddCommand(NewPrintCmd(f, globalFlags))
259259
rootCmd.AddCommand(NewRunPipelineCmd(f, globalFlags, rawConfig))
260260
rootCmd.AddCommand(NewCompletionCmd())
261+
rootCmd.AddCommand(NewVersionCmd())
261262

262263
// check overwrite commands
263264
rootCmd.AddCommand(NewDevCmd(f, globalFlags, rawConfig))

cmd/version.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package cmd
2+
3+
import (
4+
"fmt"
5+
"github.com/loft-sh/devspace/pkg/devspace/upgrade"
6+
"github.com/spf13/cobra"
7+
)
8+
9+
// NewVersionCmd returns the cobra command that outputs version
10+
func NewVersionCmd() *cobra.Command {
11+
return &cobra.Command{
12+
Use: "version",
13+
Args: cobra.NoArgs,
14+
Short: "Prints version of devspace",
15+
Run: func(cobraCmd *cobra.Command, args []string) {
16+
fmt.Println("DevSpace version : " + upgrade.GetVersion())
17+
},
18+
}
19+
}

0 commit comments

Comments
 (0)