summaryrefslogtreecommitdiff
path: root/new-post.sh
diff options
context:
space:
mode:
authorBrian Picciano <mediocregopher@gmail.com>2022-05-21 14:07:14 -0600
committerBrian Picciano <mediocregopher@gmail.com>2022-05-21 14:07:14 -0600
commitf3340ae5f4ac6c60823bf4d14e1fcdbeaaec353c (patch)
tree41d7eda870083cfa0776d650478ceeb2baee2837 /new-post.sh
parent55eb40d4bb489b2b26ab5d0ce2c70c7cb2f766b7 (diff)
Remove old code related to static, it's not needed anymore
Diffstat (limited to 'new-post.sh')
-rwxr-xr-xnew-post.sh85
1 files changed, 0 insertions, 85 deletions
diff --git a/new-post.sh b/new-post.sh
deleted file mode 100755
index 79c279a..0000000
--- a/new-post.sh
+++ /dev/null
@@ -1,85 +0,0 @@
-#!/bin/sh
-
-set -e
-
-numargs=2
-function usage {
- echo "Usage: $0 [options] <post title> <post description>
-Options:
- -i Create image directory
- -d \"YYYY-MM-DD\" Custom date to use instead of today
- -V Verbose
- -x Dry run, don't make any changes
-"
- exit 1
-}
-
-td=$(date "+%Y-%m-%d")
-
-while [ "$(echo $1 | head -c1)" = '-' -o "$#" -gt $numargs ]; do
- arg="$1"
- shift
-
- case "$arg" in
- "-i") IMG_DIR=1;;
- "-d") td=$1; shift;;
- "-V") VERBOSE=1;;
- "-x") DRY_RUN=1;;
- "--no-editor") NO_EDITOR=1;;
- *)
- echo "Unknown option '$arg'"
- usage;;
- esac
-done
-
-if [ "$#" != $numargs ]; then usage; fi
-
-if [ ! -z $VERBOSE ]; then set -x; fi
-
-title="$1"
-clean_title=$(echo "$title" |\
- tr '[:upper:]' '[:lower:]' |\
- sed 's/[^a-z0-9 ]//g' |\
- tr ' ' '-' \
- )
-
-description="$2"
-if $(echo "$description" | grep -q '[^.$!?]$'); then
- echo 'Description needs to be a complete sentence, with ending punctuation.'
- exit 1
-fi
-
-postFileName=static/src/_posts/$td-$clean_title.md
-echo "Creating $postFileName"
-postContent=$(cat <<EOF
----
-title: >-
- $title
-description: >-
- $description
-#tags: tech art crypto
----
-
-Write stuff here, title will automatically be added as an h1
-
-## Secondary header
-
-Title is already h1 so all sub-titles should be h2 or below.
-EOF
-)
-
-if [ -z $DRY_RUN ]; then
- echo "$postContent" > "$postFileName"
-fi
-
-if [ ! -z $IMG_DIR ]; then
- imgDirName="img/$clean_title"
- echo "Creating directory $imgDirName"
- if [ -z $DRY_RUN ]; then
- mkdir -p "$imgDirName"
- fi
-fi
-
-if [ -z $DRY_RUN ] && [ -z $NO_EDITOR ]; then
- exec $EDITOR "$postFileName"
-fi