From 6c66e84a868d75085a945da0c1bde1d3474166f3 Mon Sep 17 00:00:00 2001 From: ren yuze Date: Sat, 7 Sep 2019 13:37:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3curl=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E6=A0=87=E8=AF=86=E4=B8=8D=E6=B8=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vtqe/tools/curl.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/vtqe/tools/curl.go b/vtqe/tools/curl.go index 5901d04..2551c7c 100644 --- a/vtqe/tools/curl.go +++ b/vtqe/tools/curl.go @@ -180,6 +180,7 @@ func init() { curlcmd.Flags().IntP("max-time", "m", 0, "最大传输超时时间") curlcmd.Flags().Int("connect-timeout", 15, "最大连接建立超时时间") curlcmd.Flags().StringP("user-agent", "A", "", "UA设置") + curlupcmd.Flags().StringP("address", "a", "", "远端ip:端口号") curlcmd.AddCommand(curlupcmd) } @@ -188,10 +189,11 @@ var curlupcmd = &cobra.Command{ Short: "victorique上传工具", Long: "victorique上传工具", Run: func(this *cobra.Command, args []string) { - if len(args) != 2 { + if len(args) != 1 { fmt.Println(args, "不合法啊") return } + a, _ := this.Flags().GetString("address") curl := starainrt.NewStarCurl() curl.TimeOut = 0 shell := func(pect float64) { @@ -201,7 +203,7 @@ var curlupcmd = &cobra.Command{ fmt.Printf("已完成:%f%%\r", pect) } } - data, err := curl.CurlWithFile("http://"+args[0]+"/vtqeupload1127", nil, "victorique", args[1], "", false, shell) + data, err := curl.CurlWithFile("http://"+a+"/vtqeupload1127", nil, "victorique", args[0], "", false, shell) fmt.Println(string(data)) if err != nil { fmt.Println(err)