This commit is contained in:
chermack
2026-07-26 00:09:57 +08:00
commit 059be96536
134 changed files with 19678 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
package cmd
import (
"fmt"
"trojan/trojan"
"trojan/util"
"github.com/spf13/cobra"
)
// versionCmd represents the Version command
var versionCmd = &cobra.Command{
Use: "version",
Short: "显示版本号",
Run: func(cmd *cobra.Command, args []string) {
upTime := trojan.UpTime()
trojanVersion := trojan.Version()
fmt.Println()
fmt.Printf("Version: %s\n\n", util.Cyan(trojan.MVersion))
fmt.Printf("BuildDate: %s\n\n", util.Cyan(trojan.BuildDate))
fmt.Printf("GoVersion: %s\n\n", util.Cyan(trojan.GoVersion))
fmt.Printf("GitVersion: %s\n\n", util.Cyan(trojan.GitVersion))
fmt.Printf("TrojanVersion: %s\n\n", util.Cyan(trojanVersion))
fmt.Printf("TrojanUpTime: %s\n\n", util.Cyan(upTime))
},
}
func init() {
rootCmd.AddCommand(versionCmd)
}