Update 2024-12-26 14:49 OpenBSD/amd64-t14

This commit is contained in:
c0dev0id 2024-12-26 14:49:00 +01:00
parent e9581ec17d
commit 8d1878581b

View File

@ -48,14 +48,20 @@ done | (sort -t" " -k 2; echo "$_extra") \
### functions
_new() {
unset _newquit
while [ -z "$_newquit" ]
do
unset _newtitle
unset _filename
echo "Enter Post Title"
echo -n ": "
read _title
if [ -n "$_title" ]
read _newtitle
if [ -n "$_newtitle" ]
then
# Welcome to my awful filename generator / sanitizer.
# Improvements are welcome!
_filename=$(echo "$_title" \
_filename=$(echo "$_newtitle" \
| tr -d '?!%$:\\' \
| tr ' ./' '_' \
| tr -s '_' \
@ -64,18 +70,23 @@ _new() {
fi
if [ -n "$_filename" ]
then
echo "Creating content/posts/$_filename.md"
echo -n "Ok? [Y/n]"
echo "Creating:"
echo "File: content/posts/$_filename.md"
echo "Title: $_newtitle"
echo -n "Ok? [Y/n]: "
read _ok
case "$_ok" in
[nN]) return ;;
[nN]) ;;
*) hugo new content --editor=vim "content/posts/$_filename.md"
_newquit=1
;;
esac
hugo new content --editor=vim content/posts/$_filename.md
else
echo "No title entered. Returning to menu."
_newquit=1
sleep 1
fi
exit 0
done
}
_edit_entry() {
unset _quitmenu
@ -83,17 +94,16 @@ _edit_entry() {
do
clear
_f="${_newname:-$1}"
echo
echo "---------------"
echo "--- $_f:"
echo
head -15 "$_f"
echo "---------------"
echo "---"
echo
echo "Filename: $(basename "$_f")"
echo "Options: [E]dit, [D]elete, [R]ename, [T]oggle draft, [Q]uit Edit Menu"
echo -n ": "
read _opt
case $_opt in
[eE]) vim "$_f" ;;
[dD]) mkdir -p .trash; mv -f "$_f" .trash/
_quitmenu=1 ;;
[qQ]) return ;;
@ -106,12 +116,13 @@ _edit_entry() {
echo -n "ok? [Y/n]: "
read _ok
case "$_ok" in
[nN]) return ;;
[nN]) unset _newname ;;
*) _newname="content/posts/$_newname"
mv -vf "$_f" "$_newname"
;;
esac
_newname="content/posts/$_newname"
mv -vf "$_f" "$_newname"
;;
*) _quitmenu=1 ;;
*) vim "$_f" ;;
[qQ]) _quitmenu=1 ;;
esac
done
@ -122,7 +133,6 @@ case "$_selection" in
---) ;;
deploy-test) make update ;;
deploy-prod) make prod ;;
new) _new ;;
quit) _quit=1; echo "Good bye." ;;
*) [ -n "$_selection" ] \
&& _edit_entry "$_selection" \