From f3340ae5f4ac6c60823bf4d14e1fcdbeaaec353c Mon Sep 17 00:00:00 2001 From: Brian Picciano Date: Sat, 21 May 2022 14:07:14 -0600 Subject: Remove old code related to static, it's not needed anymore --- new-post.sh | 85 ------------------------------------------------------------- 1 file changed, 85 deletions(-) delete mode 100755 new-post.sh (limited to 'new-post.sh') 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] -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 <- - $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 -- cgit v1.2.3