You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 11, 2022. It is now read-only.
It looks like this is because the zsh command script output is for a command called zsh when it should be for a command called nitro. So whether you follow the instructions to write a ~/.zsh/completions/_nitro file or source <(nitro completion zsh) in your profile—two ways of doing the same thing once zsh completions are enabled—command completion fails to work.
Workaround
I’ve successfully tested a workaround on two machines by editing the static ~/.zsh/completions/_nitro output as written by Nitro 2.0.4 and 2.0.5:
Make sure the following exist somewhere in ~/.zshrc, to set a completion path and enable built-in Zsh completions:
Observe that Nitro command completion does not work.
You can optionally wreck your environment or source <(nitro completion zsh) from ~/.zshrc, but nothing will work—presumably because of the situation I described above where the wrong function is being defined.
Additional info
Nitro version: 2.0.4 and 2.0.5
Shell: zsh 5.8 (x86_64-apple-darwin20.0), with oh-my-zsh
Description
Nitro’s command completion for Zsh on macOS does not work as described in the docs and craftcms/docs#170.
It looks like this is because the zsh command script output is for a command called
zshwhen it should be for a command callednitro. So whether you follow the instructions to write a~/.zsh/completions/_nitrofile orsource <(nitro completion zsh)in your profile—two ways of doing the same thing once zsh completions are enabled—command completion fails to work.Workaround
I’ve successfully tested a workaround on two machines by editing the static
~/.zsh/completions/_nitrooutput as written by Nitro 2.0.4 and 2.0.5:~/.zshrc, to set a completion path and enable built-in Zsh completions:nitro completion zsh > "${fpath[1]}/_nitro"to write Nitro’s Zsh completion script to~/.zsh/completion/_nitro.~/.zsh/completion/_nitroto fix two lines and define anitrofunction rather thanzsh:#compdef _nitro nitro._nitro()instead of_zsh().nitro+ tab to see Nitro’s command completion working:It looks like the culprit could be here: https://github.com/craftcms/nitro/blob/main/command/completion/zsh.go#L12
And I’m probably wrong because I’m lost with Go, but Cobra is definitely looking for
%[1]sand wanting to writenitroin its place: https://github.com/spf13/cobra/blob/master/zsh_completions.go#L78Steps to reproduce
source <(nitro completion zsh)from~/.zshrc, but nothing will work—presumably because of the situation I described above where the wrong function is being defined.Additional info