diff --git a/README.md b/README.md index 8c09e00..1ef0ad8 100644 --- a/README.md +++ b/README.md @@ -13,10 +13,12 @@ The correct scopes can be verified via `gh auth status`. The last line it prints informs you of the "Token scopes". Other requirements: + * `awk` * `gh>=2.40` * `jq` * `sort` +* `tr` ## Usage diff --git a/gh-clean-notifications b/gh-clean-notifications index 159d0d0..c07b449 100755 --- a/gh-clean-notifications +++ b/gh-clean-notifications @@ -147,21 +147,22 @@ process_notifications() { -q ".data.viewer.notificationThreads.nodes[] | select(.subject.state == (${STATES})) | {\"id\":.id,\"title\":.title,\"path\":.subject.resourcePath}" ) - readarray -t my_array < <(echo "${data}" | jq -s -c '.[]') - - # If there are IDs, mark them as done. - if [ ${#my_array[@]} -gt 0 ]; then + if [ ${#data} -gt 0 ]; then IDS=() - for item in "${my_array[@]}"; do + while read -r item; do echo "Marking as Done: $(echo "${item}" | jq -r .title)" echo " https://github.com$(echo "${item}" | jq -r .path)" IDS+=(-f "ids[]=$(echo "${item}" | jq -r .id)") if test ${#IDS[@]} -eq 100 then gh api graphql --silent "${IDS[@]}" -f query="${MARK_IDS_AS_DONE_QUERY}" - IDS=() + IDS=() fi - done + + # Since this indented with spaces, EOT is fully left aligned. + done <