Version cmd
This commit is contained in:
parent
60f1711a00
commit
8f62831b9d
3 changed files with 21 additions and 2 deletions
|
|
@ -33,8 +33,6 @@ var vmSSHSetupTimeoutFlag uint32
|
||||||
var vmOSUpTimeoutFlag uint32
|
var vmOSUpTimeoutFlag uint32
|
||||||
var dataDirFlag string
|
var dataDirFlag string
|
||||||
|
|
||||||
// TODO: Version command.
|
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
slog.SetDefault(slog.New(slog.NewTextHandler(os.Stderr, nil)))
|
slog.SetDefault(slog.New(slog.NewTextHandler(os.Stderr, nil)))
|
||||||
|
|
||||||
|
|
@ -43,6 +41,7 @@ func init() {
|
||||||
rootCmd.AddCommand(shellCmd)
|
rootCmd.AddCommand(shellCmd)
|
||||||
rootCmd.AddCommand(cleanCmd)
|
rootCmd.AddCommand(cleanCmd)
|
||||||
rootCmd.AddCommand(buildCmd)
|
rootCmd.AddCommand(buildCmd)
|
||||||
|
rootCmd.AddCommand(versionCmd)
|
||||||
|
|
||||||
rootCmd.PersistentFlags().BoolVar(&vmDebugFlag, "vm-debug", false, "Enables the VM debug mode. This will open an accessible VM monitor. You can log in with root user and no password.")
|
rootCmd.PersistentFlags().BoolVar(&vmDebugFlag, "vm-debug", false, "Enables the VM debug mode. This will open an accessible VM monitor. You can log in with root user and no password.")
|
||||||
rootCmd.PersistentFlags().BoolVar(&unrestrictedNetworkingFlag, "vm-unrestricted-networking", false, "Enables unrestricted networking. This will allow the VM to connect to the internet.")
|
rootCmd.PersistentFlags().BoolVar(&unrestrictedNetworkingFlag, "vm-unrestricted-networking", false, "Enables unrestricted networking. This will allow the VM to connect to the internet.")
|
||||||
|
|
|
||||||
17
cmd/version.go
Normal file
17
cmd/version.go
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
package cmd
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"runtime"
|
||||||
|
|
||||||
|
"github.com/AlexSSD7/linsk/constants"
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
)
|
||||||
|
|
||||||
|
var versionCmd = &cobra.Command{
|
||||||
|
Use: "version",
|
||||||
|
Short: "Show Linsk version.",
|
||||||
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
|
fmt.Printf("Linsk %v %v/%v %v", constants.Version, runtime.GOOS, runtime.GOARCH, runtime.Version())
|
||||||
|
},
|
||||||
|
}
|
||||||
3
constants/linsk.go
Normal file
3
constants/linsk.go
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
package constants
|
||||||
|
|
||||||
|
const Version = "v1.0.0"
|
||||||
Loading…
Add table
Add a link
Reference in a new issue