Add version command to CLI
@@ -5,6 +5,7 @@ import (
"fmt"
"os"
"os/exec"
+ "runtime"
"github.com/epinio/epinio/helpers/kubernetes/config"
pconfig "github.com/epinio/epinio/internal/cli/config"
@@ -63,6 +64,7 @@ func Execute() {
rootCmd.AddCommand(CmdDisable)
rootCmd.AddCommand(CmdService)
rootCmd.AddCommand(CmdServer)
+ rootCmd.AddCommand(cmdVersion)
if err := rootCmd.Execute(); err != nil {
fmt.Println(err)
@@ -70,6 +72,15 @@ func Execute() {
}
}
+var cmdVersion = &cobra.Command{
+ Use: "version",
+ Short: "Print the version number",
+ Run: func(cmd *cobra.Command, args []string) {
+ fmt.Printf("Epinio Version: %s\n", version.Version)
+ fmt.Printf("Go Version: %s\n", runtime.Version())
+ },
+}
+
func checkDependencies() error {
ok := true
