match whole words in commands

If e.g. you have a AUTO_NOTIFY_WHITELIST=d, notify on "d" but not on
"diff".
This commit is contained in:
Guido Cella 2023-11-07 09:27:50 +01:00
parent 22b2c61ed1
commit 0d6e4e016d

View file

@ -89,7 +89,7 @@ function _is_auto_notify_ignored() {
if [[ -n "$AUTO_NOTIFY_WHITELIST" ]]; then if [[ -n "$AUTO_NOTIFY_WHITELIST" ]]; then
for allowed in $AUTO_NOTIFY_WHITELIST; do for allowed in $AUTO_NOTIFY_WHITELIST; do
if [[ "$target_command" == "$allowed"* ]]; then if [[ "$target_command" == "$allowed"(| *) ]]; then
print "no" print "no"
return return
fi fi
@ -97,7 +97,7 @@ function _is_auto_notify_ignored() {
print "yes" print "yes"
else else
for ignore in $AUTO_NOTIFY_IGNORE; do for ignore in $AUTO_NOTIFY_IGNORE; do
if [[ "$target_command" == "$ignore"* ]]; then if [[ "$target_command" == "$ignore"*(| *) ]]; then
print "yes" print "yes"
return return
fi fi