diff options
author | George Abbott <george@gabbott.dev> | 2023-10-31 17:54:07 +0000 |
---|---|---|
committer | George Abbott <george@gabbott.dev> | 2023-10-31 17:54:07 +0000 |
commit | 4d0bd914e7c1ee65f4036e60149a7b891906a5d3 (patch) | |
tree | c2a6751823e064e003cd4f6166df07bfc106d7eb /web/mkblog |
Commit all to date.
Diffstat (limited to 'web/mkblog')
-rwxr-xr-x | web/mkblog | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/web/mkblog b/web/mkblog new file mode 100755 index 0000000..ea91535 --- /dev/null +++ b/web/mkblog @@ -0,0 +1,22 @@ +#!/bin/sh +# Make a blog entry. Either a new entry, or edit an existing entry. + + +TEMPLATE="$BLOG_PATH/template.html" +ENTRIES_DIR="$BLOG_PATH/entries" +FILE="$ENTRIES_DIR/$1.html" + +# Handle if no parameters passed. # +if [ -z "$1" ] ; then + nvim "$ENTRIES_DIR" + exit 0 +fi + +# If parameter passed. # +if [ ! -f "$FILE" ] ; then + # We have a new blog entry. Copy template and edit that. + cp "$TEMPLATE" "$FILE" + nvim "$FILE" +else + nvim "$FILE" +fi |