Added the beginnings of a new post script

This commit is contained in:
Matthew Connelly 2015-03-09 00:58:08 +00:00
parent c95f075893
commit 7a28488fca
2 changed files with 13 additions and 0 deletions

6
posts/post.template Normal file
View File

@ -0,0 +1,6 @@
---
title:
date:
tags:
---

7
scripts/new-post Normal file
View File

@ -0,0 +1,7 @@
#!/usr/bin/env bash
TITLE=`read -e -p 'Title of new post: '`
TAGS=`read -e -p 'Tags for new post, comma-separated: '`
FNAME="`date '+%Y%m%d'`.`echo "$TITLE"|tr -cd '[:alnum:]'`.md"
cp posts/post.template posts/$FNAME
[ -z "$EDITOR" ] && echo "EDITOR environment variable not set. Please set this to your preferred editor, or open $FNAME manually"
$EDITOR posts/$FNAME