From 6be577306f3ae2ce1c0b0d4cab06654ab9aa0258 Mon Sep 17 00:00:00 2001 From: CasperGN Date: Fri, 10 Apr 2020 03:47:41 -0400 Subject: [PATCH 1/2] Added flag -silent to not print header for imbedding webanalyze into scripts --- cmd/webanalyze/main.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmd/webanalyze/main.go b/cmd/webanalyze/main.go index b01eb4a..559513c 100644 --- a/cmd/webanalyze/main.go +++ b/cmd/webanalyze/main.go @@ -25,6 +25,7 @@ var ( hosts string crawlCount int searchSubdomain bool + silent bool ) func init() { @@ -36,6 +37,7 @@ func init() { flag.StringVar(&hosts, "hosts", "", "filename with hosts, one host per line.") flag.IntVar(&crawlCount, "crawl", 0, "links to follow from the root page (default 0)") flag.BoolVar(&searchSubdomain, "search", true, "searches all urls with same base domain (i.e. example.com and sub.example.com)") + flag.BoolVar(&silent, "silent", false, "avoid printing header (default false)") } func main() { @@ -95,7 +97,9 @@ func main() { log.Fatalf("initialization failed: %v", err) } - printHeader() + if !silent { + printHeader() + } for i := 0; i < workers; i++ { wg.Add(1) From 838f9f99ea2fdbb600cbd3d53ef984d337b3cf57 Mon Sep 17 00:00:00 2001 From: CasperGN Date: Fri, 10 Apr 2020 03:49:06 -0400 Subject: [PATCH 2/2] Updated README with new flag --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 7535f45..937fb13 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,8 @@ If you want to build for yourself: output format (stdout|csv|json) (default "stdout") -search searches all urls with same base domain (i.e. example.com and sub.example.com) (default true) + -silent + avoid printing header (default false) -update update apps file -worker int