zsh:funcs: Add findup to search parent directories

This commit is contained in:
2025-07-04 13:41:30 +02:00
parent 0e7171bd5f
commit bc0de45375

View File

@@ -584,6 +584,20 @@ finddup() {
| cut -d' ' -f3-
}
# Find in parent directories
findup() {
(( $# )) || return 1
# TODO: support passing different entry point
dir="$PWD:A"
while true; do
find "$dir" -maxdepth 1 \( "$@" \)
[[ $dir != / ]] || break
dir="$dir:h"
done
}
# Wrapper around tmsu that searches for .tmsu/db in all parent directories and
# fallbacks to XDG_DATA_HOME if not found.
tag() {