Workbench

Stubble!

I started fooling around with Eleventy around the same time I started fooling around with Rust, and although typing out a few lines of front matter is not a ton of work in the scheme of things, I did find myself thinking it would be nice to have a tool that would take a title and stub out a new Markdown file for me... so I wrote one in Rust (with help from Rob!)

It's called Stubble and it's already grown a fair bit beyond the above description, but I've been trying to build it in a "works minimally, also provides power user features" frame of mind.

If you run stubble with a single argument:

stubble "My New Post"

It generates a file called YYYY-MM-DD-my-new-post.md in the current directory (where YYYY-MM-DD is the current date).

The file looks like this:

---
title: "My New Post"
date: 2023-11-14
author: "Andy Chase"
uuid: 88d71e51-391d-405e-9ead-50ae6a4ee5b7
---
# My New Post

<!-- Generated by Stubble v0.3.2 -->

It's pretty handy!

You can also add a description, and tags, override various options, and (soon) choose multiple built-in formats (Currently the only other one that's been implemented is a .org stub, but the plumbing is there for as many text-based file types as a person could need.)

Here's the help overview as of version 0.3.2, released earlier today:

Stubble is a command-line tool for quickly generating markdown files for use by static site generators. Given a title, it will generate a date-stamped markdown file with pre-populated YAML front-matter.

Usage: stubble [OPTIONS] <TITLE> [DEST]

Arguments:
  <TITLE>  Title of the post
  [DEST]   Output destination [default: .]

Options:
  -s, --slug <SLUG>                Optional slug to be used for the permalink
  -t, --tag [<TAG>...]             Tag(s) to apply to the post. Separate multiple tags with spaces
  -D, --date <DATE>                Override the post date: YYYY-MM-DD
  -d, --description <DESCRIPTION>  Post description
  -a, --author [<AUTHOR>]          The name of the author
  -f, --format [<FORMAT>]          The output format that should be used to render the stub. [default: md]
  -o, --output <OUTPUT>            Override the default filename
  -e, --editor [<EDITOR>]          Open in <EDITOR>
  -y, --yes                        Automatically answer 'Y' to all prompts (including existing file warnings)
  -h, --help                       Print help (see more with '--help')
  -V, --version                    Print version

There's no real roadmap yet; so far it's mostly been an exercise in getting familiar with Rust.

The only other major feature I have in mind is the ability to bring your own templates (Stubble uses handlebars-rust under the hood) and add your own key/value pairs.

I'm also hoping this project holds my interest long enough to build an actual info/documenation web site for it, and finally learn about getting software into various package management registries.

In the meantime, though, you can install Stubble with cargo if you already have a Rust environment on your machine:

cargo install stubble

You can also visit its Crates.io page, or look at the source code.

<!-- Generated by Stubble v0.3.2 -->


Mon Nov 13 2023 19:00:00 GMT-0500 (Eastern Standard Time)