dev: automated commit - 2025-11-10 11:45:17

This commit is contained in:
Mariano Z. 2025-11-10 11:45:17 -03:00
parent 572e1e1ced
commit 2b8553adcc

View file

@ -13,8 +13,8 @@ DEV_DIR=""
for arg in "$@"; do
case "$arg" in
--help|-h)
cat <<EOF
--help | -h)
cat <<EOF
Usage: $0 [DEV_DIR] [OPTIONS]
Options:
@ -22,17 +22,17 @@ Options:
--clear-cache Clear cache and MRU files
--help, -h Show this help message
EOF
exit 0
;;
--no-cache)
NO_CACHE=true
;;
--clear-cache)
CLEAR_CACHE=true
;;
*)
[ -z "$DEV_DIR" ] && DEV_DIR="$arg"
;;
exit 0
;;
--no-cache)
NO_CACHE=true
;;
--clear-cache)
CLEAR_CACHE=true
;;
*)
[ -z "$DEV_DIR" ] && DEV_DIR="$arg"
;;
esac
done
@ -56,12 +56,12 @@ find_git_repos() {
local cache_age=$(($(date +%s) - $(stat -c %Y "$CACHE_FILE" 2>/dev/null || echo 0)))
[ $cache_age -lt $CACHE_MAX_AGE ] && cat "$CACHE_FILE" && return
fi
if command -v fd >/dev/null 2>&1; then
fd -H -t d "^\.git$" "$DEV_DIR" -d 3 -0 | xargs -0 -n1 dirname | sort -u > "$CACHE_FILE"
fd -H -t d "^\.git$" "$DEV_DIR" -d 3 -0 | xargs -0 -n1 dirname | sort -u >"$CACHE_FILE"
else
find "$DEV_DIR" -maxdepth 3 -type d -name ".git" -print0 | \
xargs -0 -n1 dirname | sort -u > "$CACHE_FILE"
find "$DEV_DIR" -maxdepth 3 -type d -name ".git" -print0 |
xargs -0 -n1 dirname | sort -u >"$CACHE_FILE"
fi
cat "$CACHE_FILE"
}
@ -76,10 +76,10 @@ update_mru() {
local selected="$1"
local temp_file
temp_file=$(mktemp)
echo "$selected" > "$temp_file"
[ -f "$MRU_FILE" ] && grep -vFx "$selected" "$MRU_FILE" >> "$temp_file" || true
head -n "$MRU_SIZE" "$temp_file" > "$MRU_FILE"
echo "$selected" >"$temp_file"
[ -f "$MRU_FILE" ] && grep -vFx "$selected" "$MRU_FILE" >>"$temp_file" || true
head -n "$MRU_SIZE" "$temp_file" >"$MRU_FILE"
rm -f "$temp_file"
}
@ -89,17 +89,17 @@ sort_by_mru() {
local mru_list
local temp_file
temp_file=$(mktemp)
[ -f "$MRU_FILE" ] && mru_list=$(cat "$MRU_FILE" | grep -v '^$') || mru_list=""
# Output MRU items first with indicator
echo "$mru_list" | sed 's/^/⭐ /'
# Output non-MRU items using comm (fast set difference)
echo "$all_repos" | sort > "$temp_file.all"
echo "$mru_list" | sort > "$temp_file.mru"
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"
}
@ -131,7 +131,7 @@ SELECTED_DISPLAY=$(echo "$SORTED_LIST" | tofi \
--border-width 2 \
--outline-width 0 \
--font "$(fc-match -f '%{family}' 2>/dev/null || echo 'sans')" \
--font-size 14 \
--font-size 16 \
--background-color '#191724' \
--text-color '#e0def4' \
--selection-color '#31748f' \