Add version command
This commit is contained in:
20
cmd/sing-box/cmd_version.go
Normal file
20
cmd/sing-box/cmd_version.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
"runtime"
|
||||
|
||||
C "github.com/sagernet/sing-box/constant"
|
||||
F "github.com/sagernet/sing/common/format"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var commandVersion = &cobra.Command{
|
||||
Use: "version",
|
||||
Short: "Print current version of sing-box",
|
||||
Run: printVersion,
|
||||
}
|
||||
|
||||
func printVersion(cmd *cobra.Command, args []string) {
|
||||
os.Stderr.WriteString(F.ToString("sing-box version ", C.Version, " (", runtime.Version(), " ", runtime.GOOS, "/", runtime.GOARCH, ")\n"))
|
||||
}
|
||||
Reference in New Issue
Block a user