Don't show any directories ending in "-old"

This commit is contained in:
Oliver Davies 2024-01-25 18:18:16 +00:00
parent 1d11adfe94
commit 3d24bce0d9

27
bin/t
View file

@ -10,11 +10,30 @@ if [[ $# -eq 1 ]]; then
else
# Get the session name from fuzzy-finding list of directories and generating a
# tmux-safe version.
items+=$(find "${HOME}/Code" -mindepth 3 -maxdepth 3 -type d ! -name .git -not -path "${HOME}/Code/tmp/*")
items+=" "
items+=$(find "${HOME}/Code/tmp" -mindepth 1 -maxdepth 1 -type d)
selected=$(echo "${items}" | sort | fzf --reverse)
# Find all project directories within ~/Code, ignoring ~/Code/tmp as those
# are only at a single level and I don't want sub-directories within those
# directories to be shown.
items+=$(find "${HOME}/Code" \
-maxdepth 3 \
-mindepth 3 \
-type d \
! -name "*-old" \
! -name "*.old" \
! -path "${HOME}/Code/tmp/*"
)
# Add the top-level directories within ~/Code/tmp.
items+=" "
items+=$(find "${HOME}/Code/tmp" \
-maxdepth 1 \
-mindepth 1 \
-type d \
! -name "*-old" \
! -name "*.old"
)
selected=$(echo "${items}" | tr ' ' "\n" | sort | fzf --reverse)
fi
if [[ -z "${selected}" ]]; then