From 1c10548a772fae758eb7bc1a3672de0ea778205f Mon Sep 17 00:00:00 2001 From: Jan Jastrow Date: Sat, 10 Aug 2024 00:50:36 +0200 Subject: [PATCH] only offer pushover if token variable set --- zsh/scripts | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/zsh/scripts b/zsh/scripts index 9e62913..1df1925 100644 --- a/zsh/scripts +++ b/zsh/scripts @@ -39,15 +39,17 @@ function manp() { man -t $1 | pstopdf -o $TMPDIR/$1.pdf && open $TMPDIR/$1.pdf && sleep 1 && rm $TMPDIR/$1.pdf } -# pushover notification -function pushover() { - curl -s \ - --form-string "token=$pushover_token" \ - --form-string "user=$pushover_user" \ - --form-string "title=$HOST" \ - --form-string "message=$1" \ - https://api.pushover.net/1/messages.json -} +# Send pushover notification (if set) +if [[ -z "$pushover_token" ]]; then + function pushover() { + curl -s \ + --form-string "token=$pushover_token" \ + --form-string "user=$pushover_user" \ + --form-string "title=$HOST" \ + --form-string "message=$1" \ + https://api.pushover.net/1/messages.json + } +fi # png to jpeg 95 function png2jpeg() {