summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorSuleyman Farajli <suleyman@farajli.net>2025-11-04 23:07:03 +0400
committerSuleyman Farajli <suleyman@farajli.net>2025-11-04 23:07:03 +0400
commitf5aa31946cf56007b48696b029c5f0929a91612a (patch)
treeb229e4e30634a3627a2bfadfc65e978daabd0a27 /scripts
parent5489258118ca855ee49f08b52d2789b6e1eabf3f (diff)
refactor(nsend): parse command line options
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/gui/nsend28
1 files changed, 15 insertions, 13 deletions
diff --git a/scripts/gui/nsend b/scripts/gui/nsend
index 80e1764..1bfc1f4 100755
--- a/scripts/gui/nsend
+++ b/scripts/gui/nsend
@@ -14,19 +14,21 @@ EOF
exit 0
}
-check_program "notify-send" "libnotify must be installed"
-
-case "${1}" in
-"-s")
- [ "${#}" -gt 3 ] && invalid_use
-
- shift
- eval $(printf 'notify-send "%s" "%s"' "${1}" "${2}")
-
- exit 0
+case "${#}" in
+1)
+ [ "${1}" = "-h" ] && help
+ invalid_use
+;;
+2)
+ [ "${1}" = "-s" ] || invalid_use
+ notification_string="${2}"
+;;
+3)
+ [ "${1}" = "-s" ] || invalid_use
+ notification_string="${2}: ${3}"
;;
-"-h") help ;;
-
*) invalid_use ;;
-
esac
+
+
+send_notification "${notification_string}"