zsh:funcs: Add find() wrapper analog to bfs()
Only difference is that it places a trailing slash behind (empty) directory names to differentiate them better. bfs does this already. TODO: Bring these together into one function that checks $0
This commit is contained in:
@@ -759,3 +759,20 @@ rmdir() {
|
|||||||
command bfs "$@"
|
command bfs "$@"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# TODO: bring together with bfs
|
||||||
|
# find wrapper with condensed output by default (i.e. no directories except if
|
||||||
|
# they're empty)
|
||||||
|
(( ! $+commands[find] )) || find() {
|
||||||
|
emulate -L zsh
|
||||||
|
|
||||||
|
# Make sure that std{out,err} are associated with a tty and that no
|
||||||
|
# arguments were passed that start with a dash
|
||||||
|
if [[ -t 1 && -t 2 ]] && (( ! $# || ! ${@[(I)-*]} )); then
|
||||||
|
# Only print files and empty directories (and mark these with a
|
||||||
|
# trailing slash)
|
||||||
|
command find "$@" -type f -print -o -type d -empty -printf "%p/\n"
|
||||||
|
else
|
||||||
|
command find "$@"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user