mirror of
https://github.com/wyx2685/V2bX.git
synced 2026-02-05 21:20:09 +00:00
add manage command
This commit is contained in:
34
cmd/cmd.go
Normal file
34
cmd/cmd.go
Normal file
@@ -0,0 +1,34 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/spf13/cobra"
|
||||
"log"
|
||||
)
|
||||
|
||||
var (
|
||||
version = "TempVersion" //use ldflags replace
|
||||
codename = "V2bX"
|
||||
intro = "A V2board backend based on Xray-core"
|
||||
)
|
||||
|
||||
func showVersion() {
|
||||
fmt.Printf("%s %s (%s) \n", codename, version, intro)
|
||||
// Warning
|
||||
fmt.Println(Warn("This version need V2board version >= 1.7.0."))
|
||||
fmt.Println(Warn("This version changed config file. Please check config file before running."))
|
||||
}
|
||||
|
||||
var command = &cobra.Command{
|
||||
Use: "V2bX",
|
||||
PreRun: func(_ *cobra.Command, _ []string) {
|
||||
showVersion()
|
||||
},
|
||||
}
|
||||
|
||||
func Run() {
|
||||
err := command.Execute()
|
||||
if err != nil {
|
||||
log.Println("execute failed, error:", err)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user