closest - inverted find
closest finds files (or directories) in the current working directory and all
parent directories.
Example:
% pwd
/home/alice/dev/experiments/utils/closest/a/b/c
# find the closest .git directory
% closest .git
/home/alice/dev/experiments/utils/closest/.git
# add -p to show the parent directory of found files or directories
% closest -p .git
/home/alice/dev/experiments/utils/closest
# -a shows all parent .git directories / files
% closest -a .git
/home/alice/dev/experiments/utils/closest/.git
/home/alice/dev/experiments/utils/.git
/home/alice/dev/.git
# missing targets throw an error to STDERR
% closest foo
"foo" not found
exit 1
Installation
closest is a simple go program and is currently only available as
source code.
Use go's go install command to download and install closest in
your $GOPATH/bin directory.
go install codeberg.org/japh/closest@latest
Usage
%closest [options] <filename>...
Options
-a show all matches
-p only show the parent directory of any found files
Source
https://codeberg.org/japh/closest
Author
Stephen Riehm japh-codeberg@opensauce.de