Update 2023-11-08 11:02 OpenBSD/amd64-x13
This commit is contained in:
24
.bin/blog
24
.bin/blog
@@ -1,5 +1,8 @@
|
||||
#!/bin/sh
|
||||
. $HOME/.bin/_config
|
||||
|
||||
USER=sdk
|
||||
DOMAIN=home.codevoid.de
|
||||
RPATH=~/make-web/src
|
||||
|
||||
usage() {
|
||||
printf 'Usage: %s <option> <file.ext>\n' "$TYPE";
|
||||
@@ -19,10 +22,17 @@ chkfile() {
|
||||
new() {
|
||||
chkfile
|
||||
printf "New Entry:\n"
|
||||
printf "$1\n$dash\n\nChangelog:\n* $date: Created\n" > "/tmp/tmp-$date-$1" && \
|
||||
printf "$1\n" | tr '_' ' ' > "/tmp/tmp-$date-$1" && \
|
||||
vim "/tmp/tmp-$date-$1" \
|
||||
&& scp "/tmp/tmp-$date-$1" \
|
||||
$USER@$DOMAIN:"$RPATH/posts/$date-$1"
|
||||
makeblog
|
||||
}
|
||||
delete() {
|
||||
chkfile
|
||||
printf "Delete Entry: $1\n"
|
||||
ssh $USER@$DOMAIN "rm -vf $RPATH/posts/$1"
|
||||
makeblog
|
||||
}
|
||||
|
||||
list() {
|
||||
@@ -35,15 +45,19 @@ list() {
|
||||
edit() {
|
||||
chkfile
|
||||
printf "Edit Entry:\n"
|
||||
[ -z $1 ] && printf "Usage: editblog <file.gph>\n" && return
|
||||
[ -z $1 ] && printf "Usage: editblog <file.ext>\n" && return
|
||||
printf "Opening $1\n"
|
||||
local date=$(date +"%Y-%m-%d")
|
||||
scp -q $USER@$DOMAIN:"$RPATH/posts/$1" "/tmp/tmp-$1" && \
|
||||
printf "* $date: \n" >> "/tmp/tmp-$1" && \
|
||||
vim "/tmp/tmp-$1" && \
|
||||
scp -q "/tmp/tmp-$1" $USER@$DOMAIN:"$RPATH/posts/$1" && \
|
||||
rm "/tmp/tmp-$1" && \
|
||||
printf "Saved $1\n"
|
||||
makeblog
|
||||
}
|
||||
|
||||
makeblog() {
|
||||
ssh $USER@$DOMAIN "cd ~/make-web && make install"
|
||||
}
|
||||
|
||||
date=$(date +"%Y-%m-%d")
|
||||
@@ -74,6 +88,8 @@ case $1 in
|
||||
;;
|
||||
ls) list;
|
||||
;;
|
||||
rm) delete $2;
|
||||
;;
|
||||
*) usage;
|
||||
exit 2;
|
||||
;;
|
||||
|
||||
Reference in New Issue
Block a user