Last active
February 28, 2016 23:34
-
-
Save sordina/3d4cf513b6bd7e17a7b4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
rawname="" | |
if [ "$1" == "-h" ] || [ "$1" == "--help" ] | |
then | |
echo "Usage: jekyll-new-draft.sh [DRAFT NAME WITH SPACES]" 1>&2 | |
exit | |
fi | |
if [ "$1" ] | |
then | |
rawname="$*" | |
else | |
echo -n "Enter a new draft title: " 1>&2 | |
read rawname | |
fi | |
if [ ! "$rawname" ] | |
then | |
echo "" 1>&2 | |
exit | |
fi | |
filename="$(echo "$rawname" | sed -E 's/[ "()]+/_/g').markdown" | |
filepath="_drafts/$filename" | |
cat <<EOF > $filepath | |
--- | |
layout: post | |
title: "$rawname" | |
categories: blog | |
--- | |
<p class="attribution"> | |
<img src="images/" class="image fit" /> | |
<a href="">PHOTOGRAPHER</a> - | |
<a href="">"IMAGE TITLE"</a> | |
</p> | |
TEXT GOES HERE... | |
EOF | |
vim "$filepath" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment