From: Daniel Liu Date: Thu, 26 Nov 2020 04:45:28 +0000 (-0500) Subject: addde back refresh X-Git-Url: https://git.danieliu.xyz/?a=commitdiff_plain;ds=sidebyside;h=2e03339e7b72dc244ef6b944b79bf092b23289ab;p=pb.git addde back refresh --- diff --git a/pb b/pb index 7905b54..6b9a6b4 100755 --- a/pb +++ b/pb @@ -25,6 +25,13 @@ init() { echo "Successfully created blog files." } +refresh() { + read -p "Are you sure you want to refresh? [y/n] " ask + [ "$ask" != "y" ] && echo "Aborting..." && exit 0 + + echo -e "$blog_index_file\n$rolling_file\n$rss_file" | xargs sed -i "//,//{//!{//!d}}" + echo "Successfully refreshed." +} backup() { backup_name=`mktemp --tmpdir="$data_dir/backups" -d "backup_$(date +'%b-%d')_XXX"` @@ -108,5 +115,6 @@ case $1 in p|publish) publish;; d|delete) delete;; b|backup) backup;; + r|refresh) refresh;; h|*) echo -e "=-=-=-=-=-=-= Pb =-=-=-=-=-=-=\nAvailable commands:\nn - new blog post\np - publish existing blog post\nd - deletes published post\nb - creates a backup";; esac