jandamm/zgenom

_rmlint.sh:32: command not found: _arguments

rktjmp opened this issue ยท 4 comments

After updating my completion library, I see the following bug when booting zsh:

~/.zgenom/sources/zsh-users/zsh-completions/___/src/_rmlint.sh:32: command not found: _arguments

See: zsh-users/zsh-completions#809 which seems basically the same issue, and they note it's a zgen bug (so maybe inherited into zgenom), not an issue with the completion repo.

Proposed solution from the thread:

Files starts with _ like _rmfile.sh is autoloaded file in zsh file name convention. It should not be loaded manually. zgen should avoid loading such files

Thanks @rktjmp for bringing this up.

I just updated my plugins and ran into the same problem.
You can easily "fix" this by using zgenom load zsh-users/zsh-completions instead of zgenom load zsh-users/zsh-completions src.

Here's some background why this error occurs:
When providing a folder to zgenom it will add the path to fpath which
is the wanted behavior in this case.
It also iterates over all files which match *.sh and will source them.
Since zsh-completions has files like _rmlint.sh in this folder they're
matched and sourced which is the not wanted behavior - resulting in an
error.
While this could be fixed by checking for *.sh and exclude _*.sh
files I'm not sure if this is a so widely popular naming scheme that it
would not break another plugin.

It probably makes sense that the _ prefix takes precedence instead of the sh extension.

You should now be able to use zgenom load zsh-users/zsh-completions src without an error as well.
But using zgenom load zsh-users/zsh-completions is safer for the future since it uses the default entry point for plugins.

๐Ÿ‘ Good work