mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-02-20 23:47:21 -05:00
* go style commands merge v2ctl commandsw * migrate go style commands to v2ctl * fixes & code optimize * sort the commands * update commands description * restore old proto golang.org proto has removed UnmarshalText, without alternative * add test command * remove unused code * code optimize and fix * The commit simplifies the run and test commands code, * Fixes a hidden issue that the format flag not applied in command "v2ray test -format=pb ..." * fix default loader logic
30 lines
586 B
Go
30 lines
586 B
Go
package main
|
|
|
|
import (
|
|
"v2ray.com/core/commands/base"
|
|
"v2ray.com/core/main/commands"
|
|
_ "v2ray.com/core/main/distro/all"
|
|
)
|
|
|
|
func main() {
|
|
base.RootCommand.Long = "A unified platform for anti-censorship."
|
|
base.RegisterCommand(commands.CmdRun)
|
|
base.RegisterCommand(commands.CmdVersion)
|
|
base.RegisterCommand(commands.CmdTest)
|
|
base.SortLessFunc = runIsTheFirst
|
|
base.SortCommands()
|
|
base.Execute()
|
|
}
|
|
|
|
func runIsTheFirst(i, j *base.Command) bool {
|
|
left := i.Name()
|
|
right := j.Name()
|
|
if left == "run" {
|
|
return true
|
|
}
|
|
if right == "run" {
|
|
return false
|
|
}
|
|
return left < right
|
|
}
|