Skip to content

doc: Clarify behavior of --exclude #1674

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions doc/fd.1
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,14 @@ as a normal search pattern.
Exclude files/directories that match the given glob pattern.
This overrides any other ignore logic.
Multiple exclude patterns can be specified.
This uses the same syntax as ignore files (i.e. gitignore) and behaves as if
.I pattern
was a line in the global ignore file.

Note that for purposes of ignore rules, the current directory
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Current directory" is kind of ambiguous. It's really the search path that is treated as the root, not the cwd.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmm, this is.... interesting.

It looks like if there are multiple search paths, then it use the first one for all:

❯ fd
a/
a/other
a/test/
b/
b/a
b/test/
test/

❯ fd --exclude '/test' --search-path a
a/other

❯ fd --exclude '/test' --search-path b
b/a

❯ fd --exclude '/test' --search-path b --search-path b
b/a
b/a

❯ fd --exclude '/test' --search-path b --search-path a
a/other
a/test/
b/a

❯ fd --exclude '/test' --search-path a --search-path b
a/other
b/a
b/test/

is treated as the root, so patterns that begin with / will be anchored
against the current directory, not treated as absolute paths.

Examples:
\-\-exclude '*.pyc'
\-\-exclude node_modules
Expand Down