scripts/generate_post_skeleton.sh: reformat with 2 space indent

Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
Harsh Shandilya 2021-01-05 11:42:46 +05:30
parent 3f6bf07368
commit fe1d460f9d
1 changed files with 16 additions and 16 deletions

View File

@ -3,22 +3,22 @@
set -euxo pipefail
function create_post() {
local title filename postslug postdate
if [ $# -lt 1 ]; then
echo -e "\033[01;31mProviding a title is a must!\033[0m"
return
else
title="${*}"
fi
postdate="$(date +%Y-%m-%d)"
postslug="$(echo "${title}" | tr -dc '[:alnum:][:space:]\n\r' | tr '[:upper:]' '[:lower:]' | sed 's/ /-/g')"
[ -z "$postslug" ] && {
echo -e "\033[01;31mProviding a title is a must!\033[0m"
return
}
filename="${postslug}.md"
printf "+++\ncategories = []\ndate = %s\ndescription = \"\"\ndraft = true\nslug = \"%s\"\ntags = []\ntitle = \"%s\"\n+++\n" "${postdate}" "${postslug}" "${title}" > content/posts/"${filename}"
echo "content/posts/${filename} created!"
local title filename postslug postdate
if [ $# -lt 1 ]; then
echo -e "\033[01;31mProviding a title is a must!\033[0m"
return
else
title="${*}"
fi
postdate="$(date +%Y-%m-%d)"
postslug="$(echo "${title}" | tr -dc '[:alnum:][:space:]\n\r' | tr '[:upper:]' '[:lower:]' | sed 's/ /-/g')"
[ -z "$postslug" ] && {
echo -e "\033[01;31mProviding a title is a must!\033[0m"
return
}
filename="${postslug}.md"
printf "+++\ncategories = []\ndate = %s\ndescription = \"\"\ndraft = true\nslug = \"%s\"\ntags = []\ntitle = \"%s\"\n+++\n" "${postdate}" "${postslug}" "${title}" > content/posts/"${filename}"
echo "content/posts/${filename} created!"
}
create_post "${@}"