From 999d745710b9db500e82d1a0d0107ac5d623a669 Mon Sep 17 00:00:00 2001 From: Kris Lamoureux Date: Thu, 20 Nov 2025 18:13:55 -0500 Subject: [PATCH] Suppress gotify output unless verbose mode set --- gotify/.local/bin/gotify | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/gotify/.local/bin/gotify b/gotify/.local/bin/gotify index 507d7df..dd505a9 100755 --- a/gotify/.local/bin/gotify +++ b/gotify/.local/bin/gotify @@ -10,9 +10,28 @@ for cmd in curl jq; do fi done +USAGE="Usage: $0 [-v] <message>" +VERBOSE=0 +while getopts "hv" OPT; do + case "$OPT" in + h) + echo "$USAGE" + exit 0 + ;; + v) + VERBOSE=1 + ;; + *) + echo "$USAGE" + exit 1 + ;; + esac +done +shift $((OPTIND - 1)) + if [ $# -lt 3 ]; then echo "[ERROR]: Missing required arguments" - echo "Usage: $0 <priority> <title> <message>" + echo "$USAGE" exit 1 fi @@ -64,5 +83,8 @@ if ! RESPONSE=$( exit 1 fi -echo "$RESPONSE" +if [ "$VERBOSE" -eq 1 ]; then + echo "$RESPONSE" +fi + exit 0