zsh:funcs: Fix non-empty dir filter in bfs/find wrapper
The previous filter would filter out every non-regular file (e.g. symbolic links).
This commit is contained in:
@@ -738,8 +738,8 @@ rmdir() {
|
|||||||
# Make sure that std{out,err} are associated with a tty and that no
|
# Make sure that std{out,err} are associated with a tty and that no
|
||||||
# arguments were passed that start with a dash
|
# arguments were passed that start with a dash
|
||||||
if [[ -t 1 && -t 2 ]] && (( ! $# || ! ${@[(I)-*]} )); then
|
if [[ -t 1 && -t 2 ]] && (( ! $# || ! ${@[(I)-*]} )); then
|
||||||
# Only print files and empty directories
|
# Exclude non-empty directories
|
||||||
command bfs "$@" -type f -o -type d -empty
|
command bfs "$@" -type d -not -empty -o -print
|
||||||
else
|
else
|
||||||
command bfs "$@"
|
command bfs "$@"
|
||||||
fi
|
fi
|
||||||
@@ -754,9 +754,8 @@ rmdir() {
|
|||||||
# Make sure that std{out,err} are associated with a tty and that no
|
# Make sure that std{out,err} are associated with a tty and that no
|
||||||
# arguments were passed that start with a dash
|
# arguments were passed that start with a dash
|
||||||
if [[ -t 1 && -t 2 ]] && (( ! $# || ! ${@[(I)-*]} )); then
|
if [[ -t 1 && -t 2 ]] && (( ! $# || ! ${@[(I)-*]} )); then
|
||||||
# Only print files and empty directories (and mark these with a
|
# Exclude non-empty directories and mark empty ones with a slash
|
||||||
# trailing slash)
|
command find "$@" -type d \( -not -empty -o -printf "%p/\n" \) -o -print
|
||||||
command find "$@" -type f -print -o -type d -empty -printf "%p/\n"
|
|
||||||
else
|
else
|
||||||
command find "$@"
|
command find "$@"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user