diff options
-rw-r--r-- | skate/cmd/skate-cdx-lookup/main.go | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/skate/cmd/skate-cdx-lookup/main.go b/skate/cmd/skate-cdx-lookup/main.go index b480078..308fffb 100644 --- a/skate/cmd/skate-cdx-lookup/main.go +++ b/skate/cmd/skate-cdx-lookup/main.go @@ -17,9 +17,10 @@ import ( ) var ( - sleep = flag.Duration("s", 200*time.Millisecond, "sleep between requests") - cacheDir = flag.String("c", path.Join(xdg.CacheHome, "skate-cdx"), "cache dir") - quiet = flag.Bool("q", false, "no logging") + sleep = flag.Duration("s", 200*time.Millisecond, "sleep between requests") + cacheDir = flag.String("c", path.Join(xdg.CacheHome, "skate-cdx"), "cache dir") + bestEffort = flag.Bool("B", false, "best effort") + quiet = flag.Bool("q", false, "no logging") ) func main() { @@ -54,7 +55,12 @@ func main() { if !cache.Has(line) { _, b, err := skate.LookupCDX(line) if err != nil { - log.Fatal(err) + if *bestEffort { + log.Println(err) + continue + } else { + log.Fatal(err) + } } if err := cache.Set(line, b); err != nil { log.Fatal(err) @@ -66,7 +72,10 @@ func main() { log.Fatal(err) } rows, err := skate.ParseCDX(b) - if err != nil { + if *bestEffort { + log.Println(err) + continue + } else { log.Fatal(err) } fmt.Printf("[%05d] % 10d %s %s\n", i, len(rows), rows.Summary(), line) |