31 lines
529 B
Go
Raw Normal View History

2017-06-26 21:41:16 +00:00
package main
import (
"github.com/animenotifier/arn"
2017-07-06 13:04:51 +00:00
"github.com/animenotifier/arn/autocorrect"
2017-06-26 21:41:16 +00:00
"github.com/fatih/color"
)
func main() {
// Get a stream of all posts
2017-06-27 10:39:41 +00:00
allPosts, err := arn.StreamPosts()
2017-06-26 21:41:16 +00:00
arn.PanicOnError(err)
// Iterate over the stream
for post := range allPosts {
// Fix text
color.Yellow(post.Text)
2017-07-06 13:04:51 +00:00
post.Text = autocorrect.FixPostText(post.Text)
2017-06-26 21:41:16 +00:00
color.Green(post.Text)
// Tags
if post.Tags == nil {
post.Tags = []string{}
}
// Save
err = post.Save()
arn.PanicOnError(err)
}
}