dev: automated commit - 2025-11-18 10:23:16

This commit is contained in:
Mariano Z. 2025-11-18 10:23:16 -03:00
parent ba26418a15
commit dff9e3cd97
3 changed files with 28 additions and 27 deletions

View file

@ -3,7 +3,7 @@ set -euo pipefail
# Configuration
CACHE_MAX_AGE=300
MRU_SIZE=20
MRU_SIZE=5
# Debug logging (set DEBUG=1 to enable via environment variable)
DEBUG="${DEBUG:-0}"
@ -114,18 +114,23 @@ sort_by_mru() {
local all_repos="$1"
local mru_list
local temp_file
temp_file=$(mktemp)
[ -f "$MRU_FILE" ] && mru_list=$(cat "$MRU_FILE" | grep -v '^$') || mru_list=""
[ -f "$MRU_FILE" ] && mru_list=$(grep -v '^$' "$MRU_FILE") || mru_list=""
# If MRU list is empty, just return sorted repos
if [ -z "$mru_list" ]; then
echo "$all_repos" | sort
return
fi
# Output MRU items first with indicator
echo "$mru_list" | sed 's/^/⭐ /'
# Output non-MRU items using comm (fast set difference)
temp_file=$(mktemp)
echo "$all_repos" | sort >"$temp_file.all"
echo "$mru_list" | sort >"$temp_file.mru"
comm -23 "$temp_file.all" "$temp_file.mru" 2>/dev/null || cat "$temp_file.all"
rm -f "$temp_file.all" "$temp_file.mru"
}