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:
@ -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
23
cmd/d2vm/version.go
Normal 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)
|
||||
}
|
Reference in New Issue
Block a user