mirror of
https://github.com/SagerNet/sing-box.git
synced 2026-04-14 12:48:28 +10:00
28 lines
616 B
Go
28 lines
616 B
Go
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,
|
|
Args: cobra.NoArgs,
|
|
}
|
|
|
|
func printVersion(cmd *cobra.Command, args []string) {
|
|
os.Stderr.WriteString(F.ToString("sing-box version ", C.Version, " (", runtime.Version(), ", ", runtime.GOOS, "/", runtime.GOARCH, ", CGO "))
|
|
if C.CGO_ENABLED {
|
|
os.Stderr.WriteString("enabled)\n")
|
|
} else {
|
|
os.Stderr.WriteString("disabled)\n")
|
|
}
|
|
}
|