Sal's

Finding my draft posts with ripgrep

You know those moments where you think, dang, computers are so insanely fast now … so why in the world does software still feel slow??

Well ripgrep is the antidote to that feeling. It’s just mind-bogglingly fast. I flippin’ love ripgrep. I use it for so much stuff.

Anyway, today I found a nice snippet that lists all my blog posts that are still in draft status:

rg '^draft( = |: )true' --glob "*.md" --files-with-matches content

The handy bit there is '^draft( = |: )true', which will find both draft = true (TOML syntax) and draft: true (YAML syntax). Since moving to Hugo, my new posts generated with the hugo new content command have TOML frontmatter, but my old stuff has YAML. (I could easily change the default to use YAML instead, but TOML feels fun and whimsical at the moment.)

Other bits:

I stuck it in a shell script in scripts/drafts. Here’s the output at this moment:

> ./scripts/drafts
content/notes/remote-dev-ssh-config.md
content/blog/adding-backlinks.md
content/blog/personal-reference-system.md
content/blog/find-your-drafts-with-ripgrep.md
content/blog/stupid-pizza-humor.md
content/blog/blog-post-resiliency.md
content/blog/supernote-manta-thoughts.md
content/blog/success-at-blogging.md

Don’t judge me. They’re still drafts for a reason. 😉

#Hugo #Ripgrep #Command-Line #This-Blog