Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
spiritLHLS committed Jul 2, 2024
1 parent bd66776 commit b629747
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"flag"
"fmt"
"net/http"
"os"
"strings"

. "github.com/oneclickvirt/defaultset"
Expand All @@ -16,19 +17,26 @@ func main() {
http.Get("https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Foneclickvirt%2Fspeedtest&count_bg=%2323E01C&title_bg=%23555555&icon=sonarcloud.svg&icon_color=%23E7E7E7&title=hits&edge_flat=false")
}()
fmt.Println("项目地址:", Blue("https://github.com/oneclickvirt/speedtest"))
var showVersion, nearByServer, showHead bool
var showVersion, nearByServer, showHead, help bool
var language, operator, platform, testMethod string
var num int
flag.BoolVar(&showVersion, "v", false, "Show version information")
flag.BoolVar(&nearByServer, "nearby", false, "Test only nearby servers")
flag.BoolVar(&showHead, "s", true, "Show head")
flag.BoolVar(&model.EnableLoger, "e", false, "Enable logging")
flag.StringVar(&language, "l", "zh", "Language parameter (options: en, zh)")
flag.StringVar(&platform, "pf", "net", "Platform parameter (options: net, cn)")
flag.StringVar(&operator, "opt", "global", "Operator parameter (options: cmcc, cu, ct, sg, tw, jp, hk, global)")
flag.StringVar(&testMethod, "m", "speedtest", "Test Method parameter (options: origin, speedtest, speedtest-go)")
flag.IntVar(&num, "num", -1, "Number of test servers, default -1 not to limit")
flag.Parse()
speedtestFlag := flag.NewFlagSet("speedtest", flag.ContinueOnError)
speedtestFlag.BoolVar(&help, "h", false, "Show help information")
speedtestFlag.BoolVar(&showVersion, "v", false, "Show version information")
speedtestFlag.BoolVar(&nearByServer, "nearby", false, "Test only nearby servers")
speedtestFlag.BoolVar(&showHead, "s", true, "Show head")
speedtestFlag.BoolVar(&model.EnableLoger, "e", false, "Enable logging")
speedtestFlag.StringVar(&language, "l", "zh", "Language parameter (options: en, zh)")
speedtestFlag.StringVar(&platform, "pf", "net", "Platform parameter (options: net, cn)")
speedtestFlag.StringVar(&operator, "opt", "global", "Operator parameter (options: cmcc, cu, ct, sg, tw, jp, hk, global)")
speedtestFlag.StringVar(&testMethod, "m", "speedtest", "Test Method parameter (options: origin, speedtest, speedtest-go)")
speedtestFlag.IntVar(&num, "num", -1, "Number of test servers, default -1 not to limit")
speedtestFlag.Parse(os.Args[1:])
if help {
fmt.Printf("Usage: %s [options]\n", os.Args[0])
speedtestFlag.PrintDefaults()
return
}
if showVersion {
fmt.Println(model.SpeedTestVersion)
return
Expand Down

0 comments on commit b629747

Please sign in to comment.