From d7056ac8134b3e283b6336182a2d415e12d265de Mon Sep 17 00:00:00 2001 From: Max Date: Mon, 14 May 2018 19:44:46 +0200 Subject: Add feature to list all crawlable shops. (crawler) --- crawler/main.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'crawler/main.go') diff --git a/crawler/main.go b/crawler/main.go index 034c588..bfcd647 100644 --- a/crawler/main.go +++ b/crawler/main.go @@ -10,6 +10,7 @@ import ( log "github.com/Sirupsen/logrus" "github.com/jmoiron/sqlx" + flag "github.com/spf13/pflag" ) type App struct { @@ -65,6 +66,24 @@ func main() { Fatal(err, "Getting shops failed") } + // prints all crawlable shops + if "true" == flag.Lookup("shops").Value.String() { + log.SetLevel(log.InfoLevel) + for _, shop := range shops { + log.WithFields( + log.Fields{ + "shop_id": shop.Id, + "shop_url": shop.Url, + "shop_short_url": shop.Short_url, + "shop_logo_url": shop.Logo_url, + "shipping costs": shop.Shipping_costs, + "free shipping": shop.Free_shipping, + }, + ).Info(shop.Name) + } + return + } + // reruns sanitizing functions over database if app.Config.FixDatabase { err := app.fix_db() -- cgit v1.2.3