修正curl上传标识不清

master
兔子 5 years ago
parent eec673f640
commit 6c66e84a86

@ -180,6 +180,7 @@ func init() {
curlcmd.Flags().IntP("max-time", "m", 0, "最大传输超时时间") curlcmd.Flags().IntP("max-time", "m", 0, "最大传输超时时间")
curlcmd.Flags().Int("connect-timeout", 15, "最大连接建立超时时间") curlcmd.Flags().Int("connect-timeout", 15, "最大连接建立超时时间")
curlcmd.Flags().StringP("user-agent", "A", "", "UA设置") curlcmd.Flags().StringP("user-agent", "A", "", "UA设置")
curlupcmd.Flags().StringP("address", "a", "", "远端ip:端口号")
curlcmd.AddCommand(curlupcmd) curlcmd.AddCommand(curlupcmd)
} }
@ -188,10 +189,11 @@ var curlupcmd = &cobra.Command{
Short: "victorique上传工具", Short: "victorique上传工具",
Long: "victorique上传工具", Long: "victorique上传工具",
Run: func(this *cobra.Command, args []string) { Run: func(this *cobra.Command, args []string) {
if len(args) != 2 { if len(args) != 1 {
fmt.Println(args, "不合法啊") fmt.Println(args, "不合法啊")
return return
} }
a, _ := this.Flags().GetString("address")
curl := starainrt.NewStarCurl() curl := starainrt.NewStarCurl()
curl.TimeOut = 0 curl.TimeOut = 0
shell := func(pect float64) { shell := func(pect float64) {
@ -201,7 +203,7 @@ var curlupcmd = &cobra.Command{
fmt.Printf("已完成:%f%%\r", pect) 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)) fmt.Println(string(data))
if err != nil { if err != nil {
fmt.Println(err) fmt.Println(err)

Loading…
Cancel
Save