From ea7f9307c539c0bdb8cf60b5bc21b5dec6de6fb7 Mon Sep 17 00:00:00 2001 From: "David T. Sadler" Date: Sun, 15 Feb 2026 14:16:15 +0000 Subject: Stow .bin --- bin/.bin/new-episode | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100755 bin/.bin/new-episode (limited to 'bin/.bin') diff --git a/bin/.bin/new-episode b/bin/.bin/new-episode new file mode 100755 index 0000000..c8a2305 --- /dev/null +++ b/bin/.bin/new-episode @@ -0,0 +1,35 @@ +#!/usr/bin/env bash + +if [ -z "$1" ]; then + echo "Usage: new-episode " + exit 1 +fi + +EP_NUM=$(printf "%03d" "$1") + +# Capture the Name (Shift the first arg so we can join the rest). +shift +RAW_NAME="${*:-untitled}" + +# Create the Title (Capitalize first letter of every word). +# Using a simple sed regex to capitalize words. +EP_TITLE=$(echo "$RAW_NAME" | sed 's/\b./\U&/g') + +# Create the Filename Slug (Lower case and replace spaces with hyphens) +# tr '[:upper:]' '[:lower:]' handles the casing +# tr ' ' '-' handles the spaces +SLUG=$(echo "$RAW_NAME" | tr '[:upper:]' '[:lower:]' | tr ' ' '-') +FILENAME="episode-${EP_NUM}-${SLUG}.php" + +# Generate the file +cat < "$FILENAME" +