about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2020-03-15 00:33:31 +0100
committerLeah Neukirchen <leah@vuxu.org>2020-03-15 00:33:31 +0100
commit8e92a01a13f28f8647e3fd415d36b98e9129c160 (patch)
tree1375c59ac358cb62df236194da51101ccdca2e65
parent33e05c7b4bf82a03484dda1a92e3054d9f16f737 (diff)
downloadhtping-8e92a01a13f28f8647e3fd415d36b98e9129c160.tar.gz
htping-8e92a01a13f28f8647e3fd415d36b98e9129c160.tar.xz
htping-8e92a01a13f28f8647e3fd415d36b98e9129c160.zip
improve usage message
-rw-r--r--htping.go18
1 files changed, 11 insertions, 7 deletions
diff --git a/htping.go b/htping.go
index 94c9689..5a052b2 100644
--- a/htping.go
+++ b/htping.go
@@ -242,25 +242,29 @@ func (i *headers) Set(value string) error {
 func main() {
 	flag.BoolVar(&flag4, "4", false, "resolve IPv4 only")
 	flag.BoolVar(&flag6, "6", false, "resolve IPv6 only")
-	flag.Var(&myHeaders, "H", "set custom headers")
-	flag.StringVar(&method, "X", "HEAD", "HTTP method")
+	flag.Var(&myHeaders, "H", "set custom `header`s")
+	flag.StringVar(&method, "X", "HEAD", "HTTP `method`")
 
-	maxCount := flag.Int("c", -1, "count")
+	maxCount := flag.Int("c", -1, "quit after `count` requests")
 	flood := flag.Bool("f", false, "flood ping")
-	sleep := flag.Duration("i", 1*time.Second, "interval")
+	sleep := flag.Duration("i", 1*time.Second, "`interval` between requests")
 	flag.BoolVar(&kflag, "k", false, "turn TLS errors into warnings")
 
 	flag.BoolVar(&http11, "http1.1", false, "force HTTP/1.1")
 	flag.BoolVar(&keepalive, "keepalive", false,
 		"enable keepalive/use persistent connections")
 
+	flag.Usage = func() {
+		fmt.Fprintf(os.Stderr, "Usage: %s [FLAGS...] URL\n", os.Args[0])
+		flag.PrintDefaults()
+	}
+
 	flag.Parse()
 
 	args := flag.Args()
 	if len(args) != 1 {
-		fmt.Fprintf(os.Stderr, "Usage: %s [FLAGS...] URL\n", os.Args[0])
-		flag.PrintDefaults()
-		os.Exit(1)
+		flag.Usage()
+		os.Exit(2)
 	}
 	u := args[0]