X-Git-Url: https://git.danieliu.xyz/?p=pb.git;a=blobdiff_plain;f=pb;h=6b9a6b49e7df50aecf29ef8abff5ef0d87266679;hp=7905b54c34ad079cc1343be2f00f6fd691cfb5b9;hb=2e03339e7b72dc244ef6b944b79bf092b23289ab;hpb=eb9cbcb1755771257e005eb86c1225113365fae8 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