From e2135502be8b2b65a5dc0d0fcf41324ba3b66f92 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Mon, 1 Apr 2024 11:22:56 +0530 Subject: [PATCH] fix generate script --- scripts/generate_post_skeleton.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/generate_post_skeleton.sh b/scripts/generate_post_skeleton.sh index 790b0f7..1918cfd 100755 --- a/scripts/generate_post_skeleton.sh +++ b/scripts/generate_post_skeleton.sh @@ -1,9 +1,9 @@ #!/usr/bin/env bash -set -euxo pipefail +set -euo pipefail function create_post() { - local title filename postslug postdate + local title postslug postdate if [ $# -lt 1 ]; then echo -e "\033[01;31mProviding a title is a must!\033[0m" return @@ -16,9 +16,9 @@ function create_post() { echo -e "\033[01;31mProviding a title is a must!\033[0m" return } - filename="${postslug}.md" - printf "+++\ncategories = []\ndate = %s\nsummary = \"\"\ndraft = true\nslug = \"%s\"\ntags = []\ntitle = \"%s\"\n+++\n" "${postdate}" "${postslug}" "${title}" > content/posts/"${filename}" - echo "content/posts/${filename} created!" + mkdir -p content/posts/"${postslug}" + printf "+++\ncategories = []\ndate = %s\nsummary = \"\"\ndraft = true\nslug = \"%s\"\ntags = []\ntitle = \"%s\"\n+++\n" "${postdate}" "${postslug}" "${title}" > content/posts/"${postslug}"/index.md + echo "content/posts/${postslug} created!" } create_post "${@}"