You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I try to customize the notification body in order to display different emojis based on exit (status) codes. The code I put below always returns the failure one even though the status code is zero. I thought there's a trivial issue with the bash/zsh interpolation but I couldn't resolve it, so I'm wondering if someone has any idea or solution.
Thanks a lot for this nice plugin 🙌
export AUTO_NOTIFY_BODY="took %elapsed seconds, status code is %exit_code $([[ %exit_code =='0' ]] &&echo'✅'||echo'❌')"
Operating System (uname -a)
Linux personal 6.6.8-arch1-1 #1 SMP PREEMPT_DYNAMIC Thu, 21 Dec 2023 19:01:01 +0000 x86_64 GNU/Linux
zsh version (zsh --version)
zsh 5.9 (x86_64-pc-linux-gnu)
auto-notify version (echo "$AUTO_NOTIFY_VERSION")
0.8.1
How is auto-notify installed?
zplug
oh-my-zsh
Antigen
Other (please specify)
The text was updated successfully, but these errors were encountered:
I believe the issue is that the %exit_code keyword is replaced by the exit code in the _auto_notify_format() function. It's not recognised by zsh directly.
When you're exporting the AUTO_NOTIFY_BODY environmental variable, it's evaluating %exit_code as the string "%exit_code", not the value %exit_code represents later. [[ %exit_code == '0' ]] will always evaluate as false because of this.
Dynamically changing the message based on exit code isn't currently possible. I've made a pull request that adds an icon you can customise to the notification depending on whether it completes or fails, which would result in similar behaviour to the one you're attempting.
Issue Details
I try to customize the notification body in order to display different emojis based on exit (status) codes. The code I put below always returns the failure one even though the status code is zero. I thought there's a trivial issue with the bash/zsh interpolation but I couldn't resolve it, so I'm wondering if someone has any idea or solution.
Thanks a lot for this nice plugin 🙌
Operating System (uname -a)
zsh version (zsh --version)
auto-notify version (echo "$AUTO_NOTIFY_VERSION")
How is auto-notify installed?
The text was updated successfully, but these errors were encountered: