read -p "Are you sure you want to refresh? [y/n] " ask
[ "$ask" != "y" ] && echo "Aborting..." && exit 0
read -p "Are you sure you want to refresh? [y/n] " ask
[ "$ask" != "y" ] && echo "Aborting..." && exit 0
- # delete everything between tokens (remove dupe code)
echo -e "$blog_index_file\n$rolling_file\n$rss_file" | xargs sed -i "/<!-- BLOG START -->/,/<!-- BLOG END -->/{/<!-- BLOG START -->/!{/<!-- BLOG END -->/!d}}"
echo -e "$blog_index_file\n$rolling_file\n$rss_file" | xargs sed -i "/<!-- BLOG START -->/,/<!-- BLOG END -->/{/<!-- BLOG START -->/!{/<!-- BLOG END -->/!d}}"
-
- # deletes all html files and republishes all published files
-[ -f $blog_index_file ] && [ -f $rolling_file ] && [ -f $blog_template ] && [ -f $rss_file ] || { echo "You are missing a file, please check that you have $blog_index_file, $template_file, $rolling_file and $rss_file in your home directory" && exit 1; }
-
-# possibly also check to see if index and rolling have the proper headers
-
+[ -f $blog_index_file ] && [ -f $rolling_file ] && [ -f $blog_template ] && [ -f $rss_file ] || { echo "You are missing a file, please check that you have $blog_index_file, $blog_template, $rolling_file and $rss_file in your home directory" && exit 1; }
# check if blog dir exists
# check if blog dir exists
-[ ! -d $data_dir ] && init && exit
+[ ! -d $data_dir ] && init && exit 0
case $1 in
n|new) new "$2";;
p|publish) publish;;
d|delete) delete;;
case $1 in
n|new) new "$2";;
p|publish) publish;;
d|delete) delete;;
+ b|backup) backup;;
r|refresh) refresh;;
r|refresh) refresh;;
- h|*) echo "helper";;
+ h|*) echo -e "=-=-=-=-=-=-= Pb =-=-=-=-=-=-=\nAvailable commands:\nn - new blog post\np - publish existing blog post\nd - deletes published post\nb - creates a backup";;