From a7072b79f39d2889dbc4032f3cb39e77fd8242c2 Mon Sep 17 00:00:00 2001 From: St33v Date: Thu, 30 Apr 2026 14:31:09 +1000 Subject: log notify --- logNotify-lib.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'logNotify-lib.sh') diff --git a/logNotify-lib.sh b/logNotify-lib.sh index 2941df6..3f98d2f 100644 --- a/logNotify-lib.sh +++ b/logNotify-lib.sh @@ -1,8 +1,10 @@ # logging and 'notify-send' functions # SJP 2 Feb 2026 # -# -#!/usr/bin/env bash +(return 0 2>/dev/null) || { + echo "This file is meant to be sourced, not executed." >&2 + exit 1 +} APP_NAME="$(basename "${0%% *}")" JOURNAL_TAG="${APP_NAME%%.*}" @@ -26,3 +28,11 @@ log() { # Also notify (best-effort) notify "$msg" } + +die() { + local code=1 + [[ "$1" =~ ^[0-9]+$ ]] && { code="$1"; shift; } + log "ERROR: $*" + exit "$code" +} + -- cgit v1.3