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:
@@ -744,3 +744,17 @@ rmdir() {
|
|||||||
command rmdir "$@"
|
command rmdir "$@"
|
||||||
fi
|
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
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user