package cmd import ( "fmt" "github.com/spf13/cobra" ) // 添加proxy子命令 func addProxySubcommands(cmd *cobra.Command) { xrayCmd := &cobra.Command{ Use: "xray", Short: "Xray相关操作", } xrayCmd.AddCommand( &cobra.Command{ Use: "install", Short: "安装Xray", Run: func(cmd *cobra.Command, args []string) { fmt.Println("Installing Xray...") }, }, // 其他xray子命令... ) cmd.AddCommand( xrayCmd, &cobra.Command{ Use: "vmess", Short: "设置VMESS代理", Run: func(cmd *cobra.Command, args []string) { fmt.Println("Setting up VMESS proxy...") }, }, // 其他proxy子命令... ) } // 其他命令结构类似,根据需求补充完整...