diff options
| author | Max | 2018-05-14 20:36:38 +0200 |
|---|---|---|
| committer | Max | 2018-05-14 20:36:38 +0200 |
| commit | 0117d808210f78a3861f9ccea3b6b4fccb8d979f (patch) | |
| tree | 0b199bdb0c980c8f4ebf0356b4baef696508a982 /crawler/init.go | |
| parent | e55041d82bc8b486cb667ba5990d7c79e859c035 (diff) | |
| download | alkobote-0117d808210f78a3861f9ccea3b6b4fccb8d979f.tar.gz | |
Renames command line flags. Suppress unhelpful error message. (crawler)
Diffstat (limited to 'crawler/init.go')
| -rw-r--r-- | crawler/init.go | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/crawler/init.go b/crawler/init.go index 8786db6..60f7e47 100644 --- a/crawler/init.go +++ b/crawler/init.go @@ -1,6 +1,7 @@ package main import ( + "errors" "strings" log "github.com/Sirupsen/logrus" @@ -11,14 +12,17 @@ import ( var _conf Config func init() { + // overwrites unhelpful error message + flag.ErrHelp = errors.New("") + // we need to parse the config because of log level setting configFile := flag.StringP("config", "c", "", "path to config file") debug := flag.BoolP("debug", "d", false, "debug outputs") verbose := flag.BoolP("verbose", "v", false, "same as --debug") silent := flag.BoolP("silent", "s", false, "suppress outputs except warnings") loglevel_f := flag.StringP("loglevel", "l", "Warn", `sets log level, can be "Warn", "Info" or "Debug"`) - flag.Bool("shops", false, `list all crawlable shops`) - shoplist_f := flag.String("shop-list", "", `comma separated list of shop ids to crawl only these`) + flag.Bool("list-shops", false, `lists all crawlable shops`) + shopids_f := flag.StringP("restrict-shops", "r", "", `comma separated list of shop ids, crawls only these`) flag.Parse() loglevel := strings.ToLower(*loglevel_f) @@ -41,7 +45,7 @@ func init() { log.SetLevel(log.DebugLevel) } - if "" != *shoplist_f { - _conf.ShopIDs = strings.Split(*shoplist_f, ",") + if "" != *shopids_f { + _conf.ShopIDs = strings.Split(*shopids_f, ",") } } |
