From f5aa31946cf56007b48696b029c5f0929a91612a Mon Sep 17 00:00:00 2001 From: Suleyman Farajli Date: Tue, 4 Nov 2025 23:07:03 +0400 Subject: refactor(nsend): parse command line options --- scripts/gui/nsend | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'scripts') 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}" -- cgit v1.2.3