- echo "Select which post to publish"
- ls -1 "$data_dir/drafts" | nl
-
- read -p '> ' choice
- to_publish=`ls -1 "$data_dir/drafts/" | sed -n "$choice p"`
- [ -z "$to_publish" ] && echo "Invalid choice" && exit 1
-
- cat $template_file |\
- sed -e "s/{{TITLE}}/$to_publish/g" |\
- sed -e "s/{{DATE}}/`date +'%a, %b %d %H:%M'`/g" |\
- sed -e "/{{BODY}}/r $data_dir/drafts/$to_publish" |\
- sed -e "/{{BODY}}/d" # rly ugly for now
-