mirror of
https://github.com/ItsDrike/dotfiles.git
synced 2024-12-26 13:14:35 +00:00
Properly handle 'All caught up!' output from gh-notify
This commit is contained in:
parent
ed1487a251
commit
f8f96d4dd7
|
@ -190,6 +190,12 @@ send_notify() {
|
||||||
# Request unread notifications with gh-notify extension for github-cli
|
# Request unread notifications with gh-notify extension for github-cli
|
||||||
[ "$ALL" -eq 1 ] && out="$(gh notify -s -a -n "$MAX_AMOUNT")" || out="$(gh notify -s -n "$MAX_AMOUNT")"
|
[ "$ALL" -eq 1 ] && out="$(gh notify -s -a -n "$MAX_AMOUNT")" || out="$(gh notify -s -n "$MAX_AMOUNT")"
|
||||||
|
|
||||||
|
# When no notifications were found, set output to empty string, to avoid 'All caught up!' line
|
||||||
|
# being treated as notification
|
||||||
|
if [ "$out" == "All caught up!" ]; then
|
||||||
|
out=""
|
||||||
|
fi
|
||||||
|
|
||||||
total="$(printf "%s\n" "$out" | wc -l)"
|
total="$(printf "%s\n" "$out" | wc -l)"
|
||||||
# Since we always end with a newline (to count the last entry as a line), we always get
|
# Since we always end with a newline (to count the last entry as a line), we always get
|
||||||
# at least 1 as a total here, even if $out is empty. If we didn't use the \n, we'd always
|
# at least 1 as a total here, even if $out is empty. If we didn't use the \n, we'd always
|
||||||
|
|
Loading…
Reference in a new issue