Skip to content

Commit

Permalink
chore: Update progress indicator and git abbreviate length in gh-notify
Browse files Browse the repository at this point in the history
  • Loading branch information
LangLangBart committed Apr 23, 2024
1 parent dce9a68 commit 0e7176c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions gh-notify
Original file line number Diff line number Diff line change
Expand Up @@ -243,12 +243,12 @@ print_notifs() {
local all_notifs=""

while :; do
# Print "marching ants" after `get_notifs` to indicate progress.
printf >&2 "."
local_page_size=$((total_requested - fetched_count > GH_NOTIFY_PER_PAGE_LIMIT ? \
GH_NOTIFY_PER_PAGE_LIMIT : total_requested - fetched_count))
page=$(get_notifs "$page_num") || die "Failed to get notifications."
[[ -z $page ]] && break
# Print "marching ants" after `get_notifs` to indicate progress.
printf >&2 "."

page_num=$((page_num + 1))
# On each run, we can fetch up to 50 notifications. If a user requested 56, we can't specify
Expand Down Expand Up @@ -318,7 +318,8 @@ process_url() {
local type="$1" url="$2"
local number prerelease
if command grep -q "Commit" <<<"$type"; then
command basename "$url" | command head -c 7
# https://blog.cuviper.com/2013/11/10/how-short-can-git-abbreviate/
command basename "$url" | command head -c 12
elif command grep -q "Release" <<<"$type"; then
if IFS=$'\t' read -r number prerelease < <(command gh api "$url" \
--cache=100h \
Expand Down

0 comments on commit 0e7176c

Please sign in to comment.