gitea_get_notifications.sh: added cleanup path

This commit is contained in:
Oliver Schraml 2022-01-26 13:46:22 +01:00 committed by suchademon
parent 2301757eb9
commit f39462a835
Signed by: oliver.schraml
GPG Key ID: A55864B79D0D0228
1 changed files with 12 additions and 7 deletions

View File

@ -8,6 +8,11 @@ merge_count=0
open_notis_count=0 open_notis_count=0
fcount=0 fcount=0
if [ "${gettype}" == "cleanup" ]; then
gettype="merged"
markmineread=true
fi
if [ "${gettype}" == "merged" ]; then if [ "${gettype}" == "merged" ]; then
open_noti=$(tea notification ls --mine | grep -E "^\| +[0-9]+.* Pull .* open " | sed -E 's/[ \|]/@@/g;s/@@+/@@/g;s/^@@//g;s/@@$//g') open_noti=$(tea notification ls --mine | grep -E "^\| +[0-9]+.* Pull .* open " | sed -E 's/[ \|]/@@/g;s/@@+/@@/g;s/^@@//g;s/@@$//g')
@ -37,16 +42,12 @@ if [ "${gettype}" == "merged" ]; then
fi fi
done done
fi elif [ "${gettype}" == "open_all" ]; then
if [ "${gettype}" == "open_all" ]; then
open_notis=$(tea notification ls --mine | grep -E "^\| +[0-9]+.* Pull .* open " | sed -E 's/[ \|]/@@/g;s/@@+/@@/g;s/^@@//g;s/@@$//g') open_notis=$(tea notification ls --mine | grep -E "^\| +[0-9]+.* Pull .* open " | sed -E 's/[ \|]/@@/g;s/@@+/@@/g;s/^@@//g;s/@@$//g')
if [ -n "${open_notis}" ]; then if [ -n "${open_notis}" ]; then
open_notis_count=$(wc -l <<<"${open_notis}") open_notis_count=$(wc -l <<<"${open_notis}")
fi fi
fi elif [ "${gettype}" == "open" ]; then
if [ "${gettype}" == "open" ]; then
open_notis=$(tea notification ls --mine | grep -E "^\| +[0-9]+.* Pull .* open " | sed -E 's/[ \|]/@@/g;s/@@+/@@/g;s/^@@//g;s/@@$//g') open_notis=$(tea notification ls --mine | grep -E "^\| +[0-9]+.* Pull .* open " | sed -E 's/[ \|]/@@/g;s/@@+/@@/g;s/^@@//g;s/@@$//g')
for open_noti in ${open_notis}; do for open_noti in ${open_notis}; do
noti_id="$(grep -oE "^[0-9]+" <<<"${open_noti}")" noti_id="$(grep -oE "^[0-9]+" <<<"${open_noti}")"
@ -73,4 +74,8 @@ elif [ $open_notis_count -gt 0 ]; then
fcount=${open_notis_count} fcount=${open_notis_count}
fi fi
if $markmineread ; then
echo "GT"
else
echo "{\"state\":\"${i3status_state}\", \"text\":\"${fcount}\"}" echo "{\"state\":\"${i3status_state}\", \"text\":\"${fcount}\"}"
fi