aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Wittamore <philip@wittamore.com>2025-10-09 18:31:39 +0200
committerPhilip Wittamore <philip@wittamore.com>2025-10-09 18:31:39 +0200
commitc6a7d51df19e6dc06f2a120c07619980b865d0ce (patch)
treeb5b649f8b9ddece831747e4330f26448014f45d1
parentf023c7d28624c77712973ad65eb51434b35ce086 (diff)
downloadscripts-master.tar.gz
scripts-master.tar.bz2
scripts-master.zip
-rwxr-xr-xphlogthis31
1 files changed, 20 insertions, 11 deletions
diff --git a/phlogthis b/phlogthis
index e5fc496..51df9dc 100755
--- a/phlogthis
+++ b/phlogthis
@@ -2,12 +2,16 @@
# create phlog entry
# requires the text formating utility 'par'
-# editor is micro
-
-pushd "$(pwd)" || exit
+# see https://git.wittamore.com/par/tree
+# config
root="$HOME/src/gopher/phlog"
remoteroot="/srv/gopher/phlog"
+editor="micro +1:1"
+mkremotedir="ssh spike mkdir"
+
+# save location
+pushd "$(pwd)" || exit
mkdir -p "$HOME/.tmp"
cd "$HOME/.tmp" || exit
@@ -21,13 +25,11 @@ read -rp "Enter title: " title
filetitle=$(echo "$title" | sed "s/ /-/g" | sed "s/[^A-Za-z0-9._-]//g")
dirname="$filedate-$filetitle"
-# make local and remote dirs
+# make local dir
mkdir "$root/$dirname"
-echo "creating remote directory..."
-ssh spike mkdir "$remoteroot/$dirname"
# edit text
-micro +4:1 "$editfile"
+eval "$editor $editfile"
# Justify article. This may fail if a
# non-empty line doesn't contain spaces
@@ -43,20 +45,27 @@ rm $editfile
clear
cat "$dest"
-echo " "
-read -rp "Do you want to edit this text? : " choix1
+echo "--------------------------"
+read -rp "Do you want to correct this text? : " choix1
if [ "$choix1" != "n" ] ; then
clear
- micro "$dest"
+ eval "$editor $dest"
fi
echo "Article saved as $dest"
-read -rp "Run phlogmap & phlogrss & gosend? ; " choix2
+echo "--------------------------"
+read -rp "Make remote folder, run phlogmap & phlogrss & gosend? ; " choix2
if [ "$choix2" != "n" ] ; then
+ echo "creating remote directory..."
+ eval "$mkremotedir $remoteroot/$dirname"
phlogmap; phlogrss ; gosend
fi
+# return
popd || exit
+
+echo "Done."
+