github.com/v2fly/v2ray-core/v5@v5.16.2-0.20240507031116-8191faa6e095/main/commands/version.go (about)

     1  package commands
     2  
     3  import (
     4  	"fmt"
     5  
     6  	core "github.com/v2fly/v2ray-core/v5"
     7  	"github.com/v2fly/v2ray-core/v5/main/commands/base"
     8  )
     9  
    10  // CmdVersion prints V2Ray Versions
    11  var CmdVersion = &base.Command{
    12  	UsageLine: "{{.Exec}} version",
    13  	Short:     "print V2Ray version",
    14  	Long: `Prints the build information for V2Ray.
    15  `,
    16  	Run: executeVersion,
    17  }
    18  
    19  func executeVersion(cmd *base.Command, args []string) {
    20  	printVersion()
    21  }
    22  
    23  func printVersion() {
    24  	version := core.VersionStatement()
    25  	for _, s := range version {
    26  		fmt.Println(s)
    27  	}
    28  }