Skip to content

Commit

Permalink
blog: add -prepare flag for debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagokokada committed Aug 20, 2024
1 parent 3e494f2 commit 80e5144
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion blog.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ func genReadme(ps posts) string {
func main() {
slugify := flag.String("slugify", "", "Slugify input (e.g.: for blog titles)")
rss := flag.Bool("rss", false, "Generate RSS (XML) instead of README.md")
prepare := flag.Bool("prepare", false, "Prepare and print posts to Mataroa (mostly for debug)")
publish := flag.Bool("publish", false, "Publish updates to Maratoa instance")
flag.Parse()

Expand All @@ -262,7 +263,16 @@ func main() {
}

posts := grabPosts()
if *publish {
if *prepare {
for filename, post := range prepareToMataroa(posts).Iterator() {
fmt.Printf(
"%s\n# %s\n\n%s\n",
filename,
post.title,
post.contents,
)
}
} else if *publish {
publishToMataroa(posts)
} else if *rss {
fmt.Print(genRss(posts))
Expand Down

0 comments on commit 80e5144

Please sign in to comment.