Skip to content

Clarify that -e/--extension matches all entry types#1922

Open
rexkirshner wants to merge 1 commit into
sharkdp:masterfrom
rexkirshner:fix-extension-help-text
Open

Clarify that -e/--extension matches all entry types#1922
rexkirshner wants to merge 1 commit into
sharkdp:masterfrom
rexkirshner:fix-extension-help-text

Conversation

@rexkirshner

Copy link
Copy Markdown
Contributor

Summary

Fixes #1693

The help text said "Filter by file extension" which led users to expect only files would be matched. However, directories with matching extensions (e.g. a.b/) are also returned, which is correct behavior per UNIX convention.

Updated the help text to "Filter by extension (applies to all entry types)" in:

  • CLI help text
  • Man page (also added a note about using --type to restrict)
  • README

Test plan

  • No behavioral change, documentation only
  • Wording aligns with collaborator and community feedback on the issue

The help text said "Filter by file extension" which led users to expect
only files would be matched, but directories with matching extensions
(e.g. a.b/) are also returned. Clarify in the CLI help, man page, and
README that the filter applies to all entry types.

Fixes sharkdp#1693

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Comment thread doc/fd.1
Filter search results by extension
.IR ext .
This option can be used repeatedly to allow for multiple possible file extensions.
This applies to all entry types, not just files. Use \fB\-\-type\fR to restrict

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

On linux at least, a directory is a file.

Comment thread doc/fd.1
.IR ext .
This option can be used repeatedly to allow for multiple possible file extensions.
This applies to all entry types, not just files. Use \fB\-\-type\fR to restrict
the search to specific types.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
the search to specific types.
the search to specific types.

maybe?

Comment thread src/cli.rs
short = 'e',
value_name = "ext",
help = "Filter by file extension",
help = "Filter by extension (applies to all entry types)",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I don't think this is necessary in the short help (output with -h).

I think mentioning this would be fine in the long help (output with --help), which comes from the doc comment above this.

@wyf027

wyf027 commented May 16, 2026

Copy link
Copy Markdown
Contributor

Opened an alternative that incorporates @tmccombs's review (short -h text kept minimal; details in long help + man page only). Happy to close this in favor of #1922 if you prefer to update here instead.

@wyf027

wyf027 commented May 16, 2026

Copy link
Copy Markdown
Contributor

For convenience: #2001 now matches @tmccombs's review feedback (minimal -h text, man/long-help details only) and no longer includes unrelated --full-path edits (#1997).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] fd -e <ext> extension search matches foo.<ext> in directory names

3 participants