diff --git a/src/main.sh b/src/main.sh index 97c7307..dc5aa0d 100644 --- a/src/main.sh +++ b/src/main.sh @@ -6,12 +6,12 @@ err() { echo "❌ $1" >/dev/tty } # Read configuration -# shellcheck source=/dev/null CONFIGFILE="$HOME/.config/fzf-vjour/config" if [ ! -f "$CONFIGFILE" ]; then err "Configuration '$CONFIGFILE' not found." exit 1 fi +# shellcheck source=/dev/null . "$CONFIGFILE" if [ -z "${ROOT:-}" ] || [ -z "${SYNC_CMD:-}" ] || [ -z "${COLLECTION_LABELS:-}" ]; then err "Configuration is incomplete." @@ -25,6 +25,12 @@ else err "Did not find the command-line fuzzy finder fzf." exit 1 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 CAT="bat" 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) file="" while [ -f "$file" ] || [ -z "$file" ]; do - uuid=$(uuidgen) + uuid=$($UUIDGEN) file="$ROOT/$collection/$uuid.ics" done tmpmd=$(mktemp --suffix='.md')