💾 Archived View for jsreed5.org › files › microblog › microblog.sh captured on 2022-06-11 at 21:36:05.
⬅️ Previous capture (2022-06-03)
-=-=-=-=-=-=-
#!/bin/bash # offline microblog-style journaling # version: 0.7 2022-05-06 # Copyright (c) 2021-2022, Rob S # distributed under the terms of the simplified (2-clause) BSD license # gemini://jsreed5.org/files/microblog/license.txt if [[ ! "$1" ]]; then echo "Error: no timeline file specified."; exit 1; fi logdir="$(dirname $1)" timeline="$(basename $1)" if [[ ! -f "$1" ]]; then echo "Error: timeline file not found." read -r -p "[t] create new Timeline; else exit: " tlinit if [[ "${tlinit,,}" == "t" ]]; then id=$(cat /proc/sys/kernel/random/uuid | sed "s/-//g") read -r -p "Enter username: " username if [[ ! "$username" ]]; then echo "Error: username cannot be empty."; exit 1; fi read -r -p "Enter name; else leave name blank: " name read -e -p "Enter path to avatar; else generate avatar from ID: " avatarpath [[ ! -f "$avatarpath" ]] && read -r -p "[a] generate Alt (simpler) avatar; else generate default: " altavatar read -r -p "Enter bio; else leave bio blank: " bio read -r -p "Enter location; else leave location blank: " location read -r -p "Enter default post length; else length=0 (unlimited): " plength plength="$(echo "$plength" | grep -P '^(?!0+$)\d+