Skip to content

fix: hint shell builtins in command-not-found error (fixes #1944)#1998

Closed
wyf027 wants to merge 4 commits into
sharkdp:masterfrom
wyf027:fix/shell-builtin-hint-1944
Closed

fix: hint shell builtins in command-not-found error (fixes #1944)#1998
wyf027 wants to merge 4 commits into
sharkdp:masterfrom
wyf027:fix/shell-builtin-hint-1944

Conversation

@wyf027

@wyf027 wyf027 commented May 16, 2026

Copy link
Copy Markdown
Contributor

Summary

When fd -x/-X fails with "command not found" for a known shell builtin (e.g. cd), print a clearer error that explains builtins must be run via an explicit shell invocation.

Fixes #1944.

Context

Implementation follows the approach discussed in #1944 and aligns with PR #1994 by @kimjune01. That PR currently fails CI on clippy::manual-contains; this branch includes the same feature plus:

SHELL_BUILTINS.contains(&program)  // instead of .iter().any(...)

Happy to close this in favor of #1994 if the author updates their branch — goal is to get a green CI fix merged.

Checks

  • cargo fmt -- --check
  • cargo clippy --all-targets --all-features -- -Dwarnings
  • cargo test --locked

kimjune01 and others added 3 commits May 9, 2026 10:09
When a user runs `fd -x cd` or similar shell builtins that lack
standalone executables, the "Command not found" error now explains
that the command is a shell builtin and suggests invoking it through
a shell explicitly.
Use SHELL_BUILTINS.contains(&program) instead of iter().any().

Co-authored-by: Cursor <cursoragent@cursor.com>
@wyf027

wyf027 commented May 16, 2026

Copy link
Copy Markdown
Contributor Author

Gentle ping — CI green (including clippy). Ready for review. Thanks!

@wyf027

wyf027 commented May 16, 2026

Copy link
Copy Markdown
Contributor Author

Still green and ready for review. Can close if #1994 is updated with the clippy fix instead.

Expand the troubleshooting section for #1944.

Co-authored-by: Cursor <cursoragent@cursor.com>
@wyf027

wyf027 commented May 16, 2026

Copy link
Copy Markdown
Contributor Author

Note for maintainers: #1994 targets the same issue; I left a one-line clippy fix suggestion there. I can close this PR if you prefer to merge #1994 after CI is fixed.

@wyf027

wyf027 commented May 16, 2026

Copy link
Copy Markdown
Contributor Author

Friendly ping — CI green; happy to close in favor of #1994 if you prefer merging there after clippy is fixed. Thanks!

@wyf027

wyf027 commented May 16, 2026

Copy link
Copy Markdown
Contributor Author

Closing in favor of #1994 to avoid duplicate work on #1944. Left a clippy fix hint on #1994 (SHELL_BUILTINS.contains(&program)). Happy to reopen if needed.

@wyf027 wyf027 closed this May 16, 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.

'command not found' when running fd with -x cd

2 participants