Cleanup
This commit is contained in:
29
patches/post-texts/post-texts.go
Normal file
29
patches/post-texts/post-texts.go
Normal file
@ -0,0 +1,29 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/animenotifier/arn"
|
||||
"github.com/fatih/color"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Get a stream of all posts
|
||||
allPosts, err := arn.StreamPosts()
|
||||
arn.PanicOnError(err)
|
||||
|
||||
// Iterate over the stream
|
||||
for post := range allPosts {
|
||||
// Fix text
|
||||
color.Yellow(post.Text)
|
||||
post.Text = arn.FixPostText(post.Text)
|
||||
color.Green(post.Text)
|
||||
|
||||
// Tags
|
||||
if post.Tags == nil {
|
||||
post.Tags = []string{}
|
||||
}
|
||||
|
||||
// Save
|
||||
err = post.Save()
|
||||
arn.PanicOnError(err)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user