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

Created on 23 Sep 2019  Â·  11Comments  Â·  Source: sharkdp/fd

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:

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


---

$ fd --version
fd 7.4.0
```

help wanted packagintooling upstream-error

Most helpful comment

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

All 11 comments

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.

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

@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.

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

Any updates on this?

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

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

The fix is now merged upstream! :tada:

https://github.com/clap-rs/clap_generate/pull/5

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 :smile:

Released in fd 7.5.0

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sharkdp picture sharkdp  Â·  3Comments

nishithkhanna picture nishithkhanna  Â·  4Comments

longcp picture longcp  Â·  3Comments

blueray453 picture blueray453  Â·  3Comments

matu3ba picture matu3ba  Â·  4Comments