2
0
mirror of https://github.com/linka-cloud/d2vm.git synced 2025-06-27 23:52:27 +00:00

d2vm: add version command, lookup mbr.bin in well-known paths

Signed-off-by: Adphi <philippe.adrien.nousse@gmail.com>
This commit is contained in:
2022-04-21 21:15:39 +02:00
parent a21fb68b7b
commit 1a97b45861
7 changed files with 63 additions and 6 deletions

View File

@ -18,6 +18,8 @@ import (
"context"
"github.com/spf13/cobra"
"go.linka.cloud/d2vm"
)
var (
@ -31,6 +33,7 @@ var (
rootCmd = &cobra.Command{
Use: "d2vm",
SilenceUsage: true,
Version: d2vm.Version,
}
)

23
cmd/d2vm/version.go Normal file
View File

@ -0,0 +1,23 @@
package main
import (
"fmt"
"github.com/spf13/cobra"
"go.linka.cloud/d2vm"
)
var (
cmdVersion = &cobra.Command{
Use: "version",
Run: func(cmd *cobra.Command, args []string) {
fmt.Println(d2vm.Version)
fmt.Println(d2vm.BuildDate)
},
}
)
func init() {
rootCmd.AddCommand(cmdVersion)
}