zsh:bfs(): Don't print non-empty dirs by default

I sometimes use find (nowadays bfs) to get an overview of a directory.
In that case I want the output to be as short as possible.
This commit is contained in:
2025-02-05 16:32:07 +01:00
parent 767e5f3019
commit f60d25e47c

View File

@@ -744,3 +744,17 @@ rmdir() {
command rmdir "$@"
fi
}
# bfs wrapper with condensed output by default (i.e. no directories except if
# they're empty)
(( ! $+commands[bfs] )) || bfs() {
emulate -L zsh
# Check if arguments were passed that start with a dash
if (( $# && ${@[(I)-*]} )); then
command bfs "$@"
else
# Only print files and empty directories
command bfs "$@" -type f -o -type d -empty
fi
}