diff options
| author | Suleyman Farajli <suleyman@farajli.net> | 2025-11-04 23:07:03 +0400 |
|---|---|---|
| committer | Suleyman Farajli <suleyman@farajli.net> | 2025-11-04 23:07:03 +0400 |
| commit | f5aa31946cf56007b48696b029c5f0929a91612a (patch) | |
| tree | b229e4e30634a3627a2bfadfc65e978daabd0a27 | |
| parent | 5489258118ca855ee49f08b52d2789b6e1eabf3f (diff) | |
refactor(nsend): parse command line options
| -rwxr-xr-x | scripts/gui/nsend | 28 |
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}" |
