refactor: Tidy if statement into concatenation
This commit is contained in:
parent
fc0e16d0f2
commit
77af2a8315
1 changed files with 10 additions and 12 deletions
|
@ -62,19 +62,17 @@ function _auto_notify_message() {
|
|||
fi
|
||||
|
||||
elif [[ "$platform" == "Darwin" ]]; then
|
||||
if [[ -z "$AUTO_NOTIFY_SOUND" ]]; then
|
||||
osascript \
|
||||
-e 'on run argv' \
|
||||
-e 'display notification (item 1 of argv) with title (item 2 of argv)' \
|
||||
-e 'end run' \
|
||||
"$body" "$title"
|
||||
else
|
||||
osascript \
|
||||
-e 'on run argv' \
|
||||
-e 'display notification (item 1 of argv) with title (item 2 of argv) sound name (item 3 of argv)' \
|
||||
-e 'end run' \
|
||||
"$body" "$title" "$AUTO_NOTIFY_SOUND"
|
||||
notification_command="display notification (item 1 of argv) with title (item 2 of argv)"
|
||||
notification_body=($body $title)
|
||||
if [[ ! -z "$AUTO_NOTIFY_SOUND" ]]; then
|
||||
notification_command+=" sound name (item 3 of argv)"
|
||||
notification_body+=("$AUTO_NOTIFY_SOUND")
|
||||
fi
|
||||
osascript \
|
||||
-e 'on run argv' \
|
||||
-e ${notification_command[@]} \
|
||||
-e 'end run' \
|
||||
${notification_body[@]}
|
||||
else
|
||||
printf "Unknown platform for sending notifications: $platform\n"
|
||||
printf "Please post an issue on gitub.com/MichaelAquilina/zsh-auto-notify/issues/\n"
|
||||
|
|
Loading…
Add table
Reference in a new issue