Skip to content

fix(completion): teach the zsh completion the --dereference, --mindepth and --hyper aliases - #2177

Closed
ump45nose wants to merge 1 commit into
sharkdp:masterfrom
ump45nose:zsh-hidden-aliases
Closed

ump45nose wants to merge 1 commit into
sharkdp:masterfrom
ump45nose:zsh-hidden-aliases

Conversation

@ump45nose

Copy link
Copy Markdown
Contributor

Summary

The zsh completion omits three option aliases fd actually accepts:

  • --dereference — alias = "dereference" on follow (src/cli.rs)
  • --mindepth — alias("mindepth") on min_depth (src/cli.rs)
  • --hyper — alias = "hyper" on hyperlink (src/cli.rs)

The file already handles hidden aliases this way (!--mount/!--xdev for
--one-file-system, !--newer=/!--older= for the mtime flags, and
!(...)--maxdepth:depth for --max-depth), so the three additions reuse
those exact forms: !--dereference inside the (follow) group,
!(--exact-depth --min-depth)--mindepth:depth mirroring both the maxdepth
entry and the --min-depth line's own exclusion list, and --hyper taking
the canonical --hyperlink spec's value form (=-…::when:(auto never always)).

Testing

cargo/zsh could not be executed in the environment I prepared this in,
so I am not claiming a completion run: the specs were verified by direct
comparison against the alias definitions in src/cli.rs at the base commit
and the analogous entries already in _fd.

Notes

Two further aliases (--literal for --fixed-strings, --has-results for
--quiet) are intentionally left out here: their canonical specs are
touched by my open #2176 in the same group, and adding lines at the same
position in two PRs would just create a merge conflict. I plan to follow up
once that lands.

AI assistance disclosure: the omissions were found by an AI-assisted audit
diffing src/cli.rs alias/option definitions against the completion; I
verified each cited definition and the existing-entry forms in the file
myself before submitting.

Comment thread contrib/completion/_fd Resolved
Comment thread contrib/completion/_fd Resolved
Upstream already teaches zsh the --dereference / --mindepth / --hyper
aliases; keep the reviewer's shorter --hyper form that still offers the
auto/never/always values.

Signed-off-by: Vincent <1729065730@qq.com>
@ump45nose

Copy link
Copy Markdown
Contributor Author

Rebased onto current master. Most of the alias lines landed upstream in 80b135d; this tip only keeps the remaining review note so --hyper still completes auto|never|always.

Ready for another look.

@ump45nose

Copy link
Copy Markdown
Contributor Author

@tmccombs The two completion suggestions from the changes-requested review are on the current tip (a8cb80d / 8f7022a). Re-requesting review — thanks.

(AI-assisted reply.)

@tmccombs

Copy link
Copy Markdown
Collaborator

I don't think this is really necessary given that --hyper is an undocumented alias.

@tmccombs tmccombs closed this Oct 29, 2026
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.

2 participants