summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid T. Sadler <davidtsadler@googlemail.com>2026-02-15 14:16:15 +0000
committerDavid T. Sadler <davidtsadler@googlemail.com>2026-02-15 14:16:15 +0000
commitea7f9307c539c0bdb8cf60b5bc21b5dec6de6fb7 (patch)
tree5920ca555db47aee4a3a49de3c478a4a493c755e
parent9e1f32d4b2efa48890d7e48a9bd090249c7e93f8 (diff)
Stow .bin
-rw-r--r--bash/.bashrc1
-rwxr-xr-xbin/.bin/new-episode35
2 files changed, 36 insertions, 0 deletions
diff --git a/bash/.bashrc b/bash/.bashrc
index 8864fcd..03e679b 100644
--- a/bash/.bashrc
+++ b/bash/.bashrc
@@ -1,4 +1,5 @@
# .bashrc sourced by interactive, non-login shells
+PATH=~/.bin:$PATH
if [ -f ~/.bash_aliases ] ; then
. ~/.bash_aliases
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 <number> <name>"
+ 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 <<EOF > "$FILENAME"
+<?php
+
+declare(strict_types=1);
+
+/**
+ * Episode ${EP_NUM}: ${EP_TITLE}
+ * The Coding Brummie Fundamental PHP Series
+ */
+
+EOF