update branchsetup and li
This commit is contained in:
parent
09bfa9af4e
commit
a2517d5c5d
3 changed files with 46 additions and 14 deletions
|
|
@ -14,22 +14,42 @@ branching_setup() {
|
|||
return 1
|
||||
fi
|
||||
|
||||
# Build candidate ignored/untracked file list
|
||||
local -a candidates=()
|
||||
# Build candidate ignored/untracked top-level entries
|
||||
local -a raw=()
|
||||
while IFS= read -r -d '' file; do
|
||||
candidates+=("$file")
|
||||
raw+=("$file")
|
||||
done < <(git -C "$repo_root" ls-files --others --ignored --exclude-standard -z || true)
|
||||
|
||||
# Include some common dotfiles at root even if tracked (for selection convenience)
|
||||
# Reduce to top-level names (directories or files)
|
||||
local -a tops=()
|
||||
for c in "${raw[@]}"; do
|
||||
c="${c%/}"
|
||||
local top="${c%%/*}"
|
||||
[ -z "$top" ] && continue
|
||||
local found=0
|
||||
for existing in "${tops[@]}"; do
|
||||
[ "$existing" = "$top" ] && found=1 && break
|
||||
done
|
||||
[ "$found" -eq 0 ] && tops+=("$top")
|
||||
done
|
||||
|
||||
# Include common root items even if tracked (for convenience)
|
||||
for extra in .env .env.development .env.development.local .envrc .direnv flake.nix flake.lock; do
|
||||
if [ -e "$repo_root/$extra" ]; then
|
||||
candidates+=("$extra")
|
||||
local exists=0
|
||||
for t in "${tops[@]}"; do [ "$t" = "$extra" ] && exists=1 && break; done
|
||||
[ $exists -eq 0 ] && tops+=("$extra")
|
||||
fi
|
||||
done
|
||||
|
||||
# De-duplicate
|
||||
local unique
|
||||
unique=$(printf "%s\n" "${candidates[@]}" | awk '!seen[$0]++')
|
||||
# Hard-coded excludes (noise, build outputs)
|
||||
local -a EXCLUDES=(build dist)
|
||||
local -a filtered=()
|
||||
for t in "${tops[@]}"; do
|
||||
local skip=0
|
||||
for e in "${EXCLUDES[@]}"; do [ "$t" = "$e" ] && skip=1 && break; done
|
||||
[ $skip -eq 0 ] && filtered+=("$t")
|
||||
done
|
||||
|
||||
# Current config values
|
||||
local -a current
|
||||
|
|
@ -39,7 +59,7 @@ branching_setup() {
|
|||
|
||||
# Preselect current ones in fzf (mark with *)
|
||||
local list
|
||||
list=$(printf "%s\n" $unique | while read -r x; do
|
||||
list=$(printf "%s\n" "${filtered[@]}" | while read -r x; do
|
||||
local mark=""
|
||||
for c in "${current[@]}"; do [ "$c" = "$x" ] && mark="*" && break; done
|
||||
printf "%s%s\n" "$mark" "$x"
|
||||
|
|
|
|||
|
|
@ -99,6 +99,18 @@ EOF
|
|||
[ "$found" -eq 0 ] && tops+=("$top")
|
||||
done
|
||||
|
||||
# Hard-coded top-level excludes to avoid noisy build outputs
|
||||
local -a EXCLUDES=(build dist)
|
||||
if [ ${#tops[@]} -gt 0 ]; then
|
||||
local -a tops_filtered=()
|
||||
for t in "${tops[@]}"; do
|
||||
local skip=0
|
||||
for e in "${EXCLUDES[@]}"; do [ "$t" = "$e" ] && skip=1 && break; done
|
||||
[ $skip -eq 0 ] && tops_filtered+=("$t")
|
||||
done
|
||||
tops=("${tops_filtered[@]}")
|
||||
fi
|
||||
|
||||
if [ ${#tops[@]} -eq 0 ]; then
|
||||
echo "No top-level ignored/untracked entries found in $repo_root"
|
||||
return 0
|
||||
|
|
@ -126,7 +138,7 @@ EOF
|
|||
local -a chosen
|
||||
if command -v fzf >/dev/null 2>&1 && [ "$USE_FZF" -eq 1 ]; then
|
||||
local selected
|
||||
selected=$(printf "%s\n" "${filtered[@]}" | fzf --multi --height=40% --border --prompt="Select files to link: " --preview "if [ -f '$repo_root'/{} ]; then bat --color always --paging=never --style=plain '$repo_root'/{}; else ls -la '$repo_root'/{}; fi")
|
||||
selected=$(printf "%s\n" "${filtered[@]}" | fzf --multi --height=40% --border --prompt="Select items to link: " --preview "if [ -f '$repo_root'/{} ]; then bat --color always --paging=never --style=plain '$repo_root'/{}; else ls -la '$repo_root'/{}; fi")
|
||||
if [ -z "$selected" ]; then
|
||||
echo "No files selected." && return 0
|
||||
fi
|
||||
|
|
|
|||
8
hosts/lio/flake.lock
generated
8
hosts/lio/flake.lock
generated
|
|
@ -1269,11 +1269,11 @@
|
|||
},
|
||||
"locked": {
|
||||
"dir": "flakes/secrets",
|
||||
"lastModified": 1761107519,
|
||||
"narHash": "sha256-HV+W8peuB0elo/32CgwfITp/ox4dFDXaM22z/HlmZ2c=",
|
||||
"lastModified": 1762828900,
|
||||
"narHash": "sha256-0AtMggGG2kUpE3HpWEweLe2jlstMGhEGAHBgqBXA2Ds=",
|
||||
"ref": "refs/heads/master",
|
||||
"rev": "9de4c7892bdf28735875d43849d67d9b16b6d700",
|
||||
"revCount": 731,
|
||||
"rev": "1dd7e442dd99d8f3e3867655ecb0c5f4d666853c",
|
||||
"revCount": 774,
|
||||
"type": "git",
|
||||
"url": "https://git.joshuabell.xyz/ringofstorms/dotfiles"
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue