From 1b4a98bc2b94e38f9199a333712164ce75f09d32 Mon Sep 17 00:00:00 2001 From: James Dixon Date: Sun, 16 Mar 2025 03:38:14 -0400 Subject: [PATCH] Make new post work with BLOG_DIR and add dir subcmd --- config/bash/.local/bin/hu | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/config/bash/.local/bin/hu b/config/bash/.local/bin/hu index dd486e5..f779bd1 100755 --- a/config/bash/.local/bin/hu +++ b/config/bash/.local/bin/hu @@ -5,19 +5,22 @@ # Relies on BLOG_DIR to be set from environment hu() { - echo "$BLOG_DIR" if [ "$1" == "np" ]; then POST_NAME="$2" if [ -z "$POST_NAME" ]; then read -p "Enter a post title (omitting .md): " POST_NAME fi - hugo new posts/$POST_NAME.md; + hugo new -s "$BLOG_DIR" posts/$POST_NAME.md; fi if [ "$1" == "rm" ]; then rm "$BLOG_DIR/content/posts/$2.md" fi + if [ "$1" == "dir" ]; then + echo "$BLOG_DIR" + fi + if [ "$1" == "ls" ]; then hugo list all -s "$BLOG_DIR" | sed 1d | awk -F',' '{print $1, $(NF-4)}' | column -t fi