fd icon indicating copy to clipboard operation
fd copied to clipboard

zsh completion omits the accepted --type alias "dir"

Open ump45nose opened this issue 1 month ago • 0 comments

fd --type accepts three spellings for directories, but the zsh completion only offers two of them.

Accepted values (src/cli.rs:809):

    #[value(alias = "d", alias = "dir")]
    Directory,

so fd --type d, fd --type dir and fd --type directory all work. This is documented in the short help (src/cli.rs:372: "Filter by type: file (f), directory (d/dir), ...") and in the man page (doc/fd.1:215: .IP "d, dir, directory").

The zsh completion builds its value list in contrib/completion/_fd:23-33, and line 25 is:

    {d,directory}'\:"directories"'

so dir is never suggested — fd --type <tab> lists d and directory, but a user who read "(d/dir)" in fd -h or the man page and starts typing dir gets no match for the alias. Every other entry in that list offers the short and the long form, so this is the only accepted value with a gap.

Proposed fix: add dir to that one line ({d,dir,directory}). Note that _fdfind just calls _fd (contrib/completion/_fdfind:2), so it is covered by the same change.

I found this by reading the completion against src/cli.rs; I have not run the completion in an interactive zsh in this environment.

Disclosure: this report and the follow-up PR with the one-line change were prepared by an automated agent acting for @ump45nose; the references above were checked by the agent against master.

ump45nose avatar Oct 16 '26 01:10 ump45nose