This commit is contained in:
2025-06-02 23:28:42 +02:00
parent b613c25f98
commit 83061bd54b

View File

@@ -6,12 +6,12 @@ err() {
echo "$1" >/dev/tty echo "$1" >/dev/tty
} }
# Read configuration # Read configuration
# shellcheck source=/dev/null
CONFIGFILE="$HOME/.config/fzf-vjour/config" CONFIGFILE="$HOME/.config/fzf-vjour/config"
if [ ! -f "$CONFIGFILE" ]; then if [ ! -f "$CONFIGFILE" ]; then
err "Configuration '$CONFIGFILE' not found." err "Configuration '$CONFIGFILE' not found."
exit 1 exit 1
fi fi
# shellcheck source=/dev/null
. "$CONFIGFILE" . "$CONFIGFILE"
if [ -z "${ROOT:-}" ] || [ -z "${SYNC_CMD:-}" ] || [ -z "${COLLECTION_LABELS:-}" ]; then if [ -z "${ROOT:-}" ] || [ -z "${SYNC_CMD:-}" ] || [ -z "${COLLECTION_LABELS:-}" ]; then
err "Configuration is incomplete." err "Configuration is incomplete."
@@ -25,6 +25,12 @@ else
err "Did not find the command-line fuzzy finder fzf." err "Did not find the command-line fuzzy finder fzf."
exit 1 exit 1
fi fi
if command -v "uuidgen" >/dev/null; then
UUIDGEN="uuidgen"
else
err "Did not find the uuidgen command."
exit 1
fi
if command -v "bat" >/dev/null; then if command -v "bat" >/dev/null; then
CAT="bat" CAT="bat"
elif command -v "batcat" >/dev/null; then elif command -v "batcat" >/dev/null; then
@@ -148,7 +154,7 @@ if [ "${1:-}" = "--new" ]; then
collection=$(echo "$COLLECTION_LABELS" | tr ';' '\n' | fzf --delimiter='=' --with-nth=2 --accept-nth=1) collection=$(echo "$COLLECTION_LABELS" | tr ';' '\n' | fzf --delimiter='=' --with-nth=2 --accept-nth=1)
file="" file=""
while [ -f "$file" ] || [ -z "$file" ]; do while [ -f "$file" ] || [ -z "$file" ]; do
uuid=$(uuidgen) uuid=$($UUIDGEN)
file="$ROOT/$collection/$uuid.ics" file="$ROOT/$collection/$uuid.ics"
done done
tmpmd=$(mktemp --suffix='.md') tmpmd=$(mktemp --suffix='.md')