Skip to content
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

fd zsh completion shows error 'zsh: command not found: a' #487

Closed
b0o opened this issue Sep 23, 2019 · 11 comments · Fixed by clap-rs/clap_generate#5
Closed

fd zsh completion shows error 'zsh: command not found: a' #487

b0o opened this issue Sep 23, 2019 · 11 comments · Fixed by clap-rs/clap_generate#5

Comments

@b0o
Copy link

b0o commented Sep 23, 2019

Attempting to use fd's zsh completion outputs an annoying "command not found: a" upon requesting completion with the tab key. Screencast:

asciicast

I narrowed it down to line 73 in the generated zsh completion script (installed at /usr/share/zsh/site-functions/_fd on Arch Linux):

'::pattern -- the search pattern: a regular expression unless '--glob' is used (optional):_files' \

Escaping the third : solves the issue:

'::pattern -- the search pattern\: a regular expression unless '--glob' is used (optional):_files' \

$ fd --version
fd 7.4.0
@sharkdp
Copy link
Owner

sharkdp commented Sep 23, 2019

Thank you for reporting this and for the analysis.

I haven't looked at it in detail, but it looks like a bug in the autogeneration of clap which should probably be reported upstream.

@farzadmf
Copy link

farzadmf commented Sep 27, 2019

I noticed this bug today, and I'm using oh-my-zsh. For me, adding fd to plugins seems to fix the issue:

plugins=(... fd)

PS: the plugin's readme says that definitions are taken from version 7.3.0, but my current version is 7.4.0, so I'm not sure if what I'm seeing is up-to-date, but at least I don't see that error

@b0o
Copy link
Author

b0o commented Sep 27, 2019

@farzamf yeah, that would load the fd completion from oh-my-zsh which, as you noted, is from an older version of fd and doesn’t have this bug. Good workaround in the time being, though.

@barskern
Copy link

barskern commented Oct 1, 2019

I just made a PR upstream which will fix this issue. 😄

@laixintao
Copy link

Any updates on this?

@barskern
Copy link

Sadly no action has been taken upstream yet. You could watch the following PR: clap-rs/clap_generate#5

@QIanGua
Copy link

QIanGua commented Jan 2, 2020

Can you show how to fix it manually? I can't find the path of clap-rs on mac OS. Thanks.

@barskern
Copy link

barskern commented Feb 3, 2020

The fix is now merged upstream! 🎉

clap-rs/clap_generate#5

@sharkdp sharkdp closed this as completed in 2f18903 Feb 6, 2020
@sharkdp
Copy link
Owner

sharkdp commented Feb 6, 2020

Thank you, @barskern. I'm not sure how this integrates with the main clap repo. Until this ends up in a release, I went the easy way and replaced the : with a -. Could have done this earlier, sorry 😄

@sharkdp
Copy link
Owner

sharkdp commented Mar 22, 2020

Released in fd 7.5.0

@laixintao
Copy link

Thanks! I hope the latest version can be released on brew soon.

peienxie added a commit to peienxie/dotfiles that referenced this issue Sep 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants