aboutsummaryrefslogtreecommitdiff
path: root/phlogthis
diff options
context:
space:
mode:
authorPhilip Wittamore <philip@wittamore.com>2025-11-08 17:52:58 +0100
committerPhilip Wittamore <philip@wittamore.com>2025-11-08 17:52:58 +0100
commit5637b6bc9e9ca99779fd6483318f33a6fe38152d (patch)
treee7c7f5556be89e8f11ded44ca167a473032bcdfe /phlogthis
parent301c765535e2dc4e51a3b756e2b830dbe51293aa (diff)
downloadscripts-master.tar.gz
scripts-master.tar.bz2
scripts-master.zip
Diffstat (limited to 'phlogthis')
-rwxr-xr-xphlogthis20
1 files changed, 10 insertions, 10 deletions
diff --git a/phlogthis b/phlogthis
index e218b3c..8de9302 100755
--- a/phlogthis
+++ b/phlogthis
@@ -5,10 +5,12 @@
# see https://git.wittamore.com/par/tree
# config
-root="$HOME/src/gopher/phlog"
+root="$HOME/src/gopher/phlog/"
remoteroot="/srv/gopher/phlog"
editor="micro +1:1"
-mkremotedir="ssh spike mkdir"
+mkremotedir="ssh spike mkdir -p"
+mkdir -p "$root/$(date +%Y)"
+eval "$mkremotedir $remoteroot/$(date +%Y)"
# save location
pushd "$(pwd)" || exit
@@ -18,15 +20,15 @@ cd "$HOME/.tmp" || exit
editfile="phlogtmp.txt"
articledate="$(date -R)"
filedate="$(date +%Y-%m-%d-%H-%I)"
-article="/tmp/gophermap.tmp"
+article="$HOME/.tmp/article.tmp"
read -rp "Enter title: " title
filetitle=$(echo "$title" | sed "s/ /-/g" | sed "s/[^A-Za-z0-9._-]//g")
-dirname="$filedate-$filetitle"
+articlename="$filedate-$filetitle.txt"
# make local dir
-mkdir "$root/$dirname"
+#mkdir "$root/$dirname"
# edit text
eval "$editor $editfile"
@@ -38,9 +40,9 @@ cat "$editfile" | par -jw67 > $article || cat "$editfile" > $article
header="$title\n$articledate\n+$(printf "%*s" 65 | tr " " "-")+\n\n"
sed -i "1s/^/$header/" $article
-dest="$root/$dirname/gophermap"
+dest="$root/$(date +%Y)/$articlename"
mv "$article" "$dest"
-echo "\n\n␌" >> "$dest"
+echo -e "\n\n␌" >> "$dest"
rm $editfile
clear
@@ -57,11 +59,9 @@ fi
echo "Article saved as $dest"
echo "--------------------------"
-read -rp "Make remote folder, run phlogmap & phlogrss & gosend? ; " choix2
+read -rp "run phlogmap & phlogrss & gosend? ; " choix2
if [ "$choix2" != "n" ] ; then
- echo "creating remote directory..."
- eval "$mkremotedir $remoteroot/$dirname"
phlogmap; phlogrss ; gosend
fi