diff options
author | René 'Necoro' Neumann <necoro@necoro.eu> | 2020-06-20 22:37:44 +0200 |
---|---|---|
committer | René 'Necoro' Neumann <necoro@necoro.eu> | 2020-06-20 22:37:44 +0200 |
commit | eefdc799b929a4d6407737d281c34dd940e2823f (patch) | |
tree | 8cf6b1842dc5ca6a5044c1b3caba0916b8328eca /tools | |
parent | 92f8d785ea478c02efd32f03478bcd11c85b40a4 (diff) | |
download | feed2imap-go-eefdc799b929a4d6407737d281c34dd940e2823f.tar.gz feed2imap-go-eefdc799b929a4d6407737d281c34dd940e2823f.tar.bz2 feed2imap-go-eefdc799b929a4d6407737d281c34dd940e2823f.zip |
print-cache: Tool for printing the contents of the cache
Diffstat (limited to 'tools')
-rw-r--r-- | tools/print-cache/print-cache.go | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/tools/print-cache/print-cache.go b/tools/print-cache/print-cache.go new file mode 100644 index 0000000..d20963a --- /dev/null +++ b/tools/print-cache/print-cache.go @@ -0,0 +1,36 @@ +package main + +import ( + "flag" + "fmt" + "log" + + "github.com/Necoro/feed2imap-go/internal/feed" +) + +// flags +var ( + cacheFile string = "feed.cache" + feedId string = "" +) + +func init() { + flag.StringVar(&cacheFile, "c", cacheFile, "cache file") + flag.StringVar(&feedId, "i", feedId, "id of the feed") +} + +func main() { + flag.Parse() + + cache, err := feed.LoadCache(cacheFile) + if err != nil { + log.Fatal(err) + } + + fmt.Printf("Cache version %d\n", cache.Version()) + if feedId != "" { + fmt.Print(cache.SpecificInfo(feedId)) + } else { + fmt.Print(cache.Info()) + } +} |