2018-10-13 14:00:59 +00:00
|
|
|
#! /bin/sh
|
2017-11-10 12:28:35 +00:00
|
|
|
|
2017-11-11 23:06:49 +00:00
|
|
|
date=$(date +%Y-%m-%d)
|
2017-11-10 12:28:35 +00:00
|
|
|
title=
|
|
|
|
author=
|
|
|
|
|
|
|
|
function input {
|
|
|
|
echo "Enter post title:"
|
|
|
|
read title
|
|
|
|
echo "Enter author name:"
|
|
|
|
read author
|
|
|
|
}
|
|
|
|
|
|
|
|
function confirmation {
|
|
|
|
echo "Is the following correct?"
|
|
|
|
echo "title: $title"
|
|
|
|
echo "author: $author"
|
|
|
|
echo "y/n"
|
|
|
|
}
|
|
|
|
|
|
|
|
function main {
|
|
|
|
local conf="n"
|
|
|
|
while [ "$conf" != "y" ]
|
|
|
|
do
|
|
|
|
input
|
|
|
|
confirmation
|
|
|
|
read conf
|
|
|
|
done
|
|
|
|
postname="./site/posts/$date-${title// /-}.md"
|
|
|
|
echo -e "---\ntitle: ${title}\nauthor: ${author}\ndescription: \n---" >> $postname
|
2017-11-11 23:09:03 +00:00
|
|
|
${VISUAL:-vim} $postname
|
2017-11-10 12:28:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
main
|
|
|
|
|
|
|
|
unset date title author
|