From c9cca37ca6f7f62804bf53d2df2d5107523a572e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D0=B0=D1=85=D0=BD=D0=BE=D0=B2=20=D0=93=D0=BB=D0=B5?= =?UTF-8?q?=D0=B1=20=D0=90=D0=BD=D0=B4=D1=80=D0=B5=D0=B5=D0=B2=D0=B8=D1=87?= Date: Sat, 4 Dec 2021 00:16:55 +0300 Subject: [PATCH] more verbose usage help --- cero.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/cero.go b/cero.go index e7ccc4a..9811178 100644 --- a/cero.go +++ b/cero.go @@ -28,6 +28,11 @@ var ( onlyValidDomainNames bool ) +var usage = "" + + `usage: cero [options] [targets] +if [targets] not provided in commandline arguments, will read from stdin +` + func main() { // parse CLI arguments var ports string @@ -37,6 +42,14 @@ func main() { flag.StringVar(&ports, "p", "443", "TLS ports to use, if not specified explicitly in host address. Use comma-separated list") flag.IntVar(&timeout, "t", 4, "TLS Connection timeout in seconds") flag.BoolVar(&onlyValidDomainNames, "d", false, "Output only valid domain names (e.g. strip IPs, wildcard domains and gibberish)") + + // set custom usage text + flag.Usage = func() { + fmt.Fprintln(os.Stderr, usage) + fmt.Fprintln(os.Stderr, "options:") + flag.PrintDefaults() + } + flag.Parse() // parse default port list into string slice