summaryrefslogtreecommitdiff
path: root/scripts/nsend
diff options
context:
space:
mode:
authorSüleyman Fərəcli <suleyman@farajli.net>2025-06-18 00:39:02 +0400
committerGitHub <noreply@github.com>2025-06-18 00:39:02 +0400
commit1eb90cf48629b8dfc0182cbe38b34c8082f4dc40 (patch)
treecf16ea2a5672cc8e1fc5ba97bdbc1396b485bbe7 /scripts/nsend
parentc583f7d1c796bd4d82572cb3dd0caa52c8b4ecbf (diff)
parent0495f17898e621b5b7199b20d2ee28d2841a5a2a (diff)
Merge pull request #8 from sfarajli/dev
Dev
Diffstat (limited to 'scripts/nsend')
-rwxr-xr-xscripts/nsend21
1 files changed, 8 insertions, 13 deletions
diff --git a/scripts/nsend b/scripts/nsend
index b8f9a00..7337b4d 100755
--- a/scripts/nsend
+++ b/scripts/nsend
@@ -1,5 +1,7 @@
#!/bin/sh
+. slib
+
help() {
cat << EOF
${0}: Wrapper script to send notifications
@@ -9,29 +11,22 @@ options:
-s [Msg] Send Msg Without Name
-h Print this message and exit
EOF
-}
-err() {
- for line in "${@}"; do
- echo "${line}" >&2
- done
- exit 1
+exit 0
}
-if ! command -v notify-send > /dev/null 2>&1; then
- err "${0}: dunst must be installed"
-fi
+check_program "notify-send" "dunst must be installed"
case "${1}" in
"-s")
- [ ${#} -gt 3 ] && err "${0}: Invalid usage" "Try '${0} -h' for help."
+ [ "${#}" -gt 3 ] && invalid_use
- notify-send "${2}" "${3}" > /dev/null 2>&1 || err "${0}: Failed to send notification"
+ run "notify-send ${2} ${3}"
exit 0
;;
-"-h") help; exit 0 ;;
+"-h") help ;;
-*) err "${0}: Invalid usage" "Try '${0} -h' for help." ;;
+*) invalid_use ;;
esac