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