From 98a04266f9992d24064e80288d65481be71fc3ae Mon Sep 17 00:00:00 2001 From: Kenneth Shaw Date: Thu, 9 Feb 2017 13:04:50 +0700 Subject: [PATCH] Fixing chromedp-gen flag parameters and updating README.md --- README.md | 3 +-- cmd/chromedp-gen/internal/flag.go | 7 +++++-- cmd/chromedp-gen/main.go | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 9fb9d15..2402959 100644 --- a/README.md +++ b/README.md @@ -99,10 +99,9 @@ func googleSearch(q, text string, site, res *string) cdp.Tasks { Please see the [examples](examples/) directory for examples. ## TODO +* Unit tests / coverage: travis-ci + coveralls integration * Move timeouts to context (defaults) * Implement more query selector options (allow over riding context timeouts) * Contextual actions for "dry run" (or via an accumulator?) * Network loader / manager -* More examples * Profiler -* Unit tests / coverage: travis-ci + coveralls integration diff --git a/cmd/chromedp-gen/internal/flag.go b/cmd/chromedp-gen/internal/flag.go index b5da38e..7e6c2da 100644 --- a/cmd/chromedp-gen/internal/flag.go +++ b/cmd/chromedp-gen/internal/flag.go @@ -1,9 +1,12 @@ package internal -import "flag" +import ( + "flag" + "os" +) // FlagSet is the set of application flags. -var FlagSet = &flag.FlagSet{} +var FlagSet = flag.NewFlagSet(os.Args[0], flag.ExitOnError) // The application flags. var ( diff --git a/cmd/chromedp-gen/main.go b/cmd/chromedp-gen/main.go index 63a557c..8ada62e 100644 --- a/cmd/chromedp-gen/main.go +++ b/cmd/chromedp-gen/main.go @@ -23,7 +23,7 @@ func main() { var err error // parse flags - err = internal.FlagSet.Parse(os.Args) + err = internal.FlagSet.Parse(os.Args[1:]) if err != nil { fmt.Fprintf(os.Stderr, "error: %v\n", err) os.Exit(1)