Skip to content

Commit

Permalink
exclude the starting-point from the list of files to file
Browse files Browse the repository at this point in the history
  • Loading branch information
jakebman committed Dec 18, 2024
1 parent c2af6a2 commit d862a38
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion plugins/available/jake-implicit-commands.plugin.bash
Original file line number Diff line number Diff line change
Expand Up @@ -363,9 +363,10 @@ function file {
if [[ "$#" -eq 0 ]]; then
# A safer form of file -E * using find
# -maxdepth 1 - find only the files under the starting-point
# -mindepth 1 - exclude the starting point (at depth 0)
# -printf '%P\0' - customizing a form of -print0 which strips the ./ prefix that -print0 gives
# %P: File's name with the name of the starting-point under which it was found removed.
find . -maxdepth 1 -printf '%P\0' | xargs --null file -E | pager
find . -maxdepth 1 -mindepth 1 -printf '%P\0' | xargs --null file -E | pager
else
command file -E "$@" | pager
fi
Expand Down

0 comments on commit d862a38

Please sign in to comment.