Using SPM Shell completion script in oh-my-zsh

Hi,

I'd like to leverage shell completion script in oh-my-zsh

I added the script with swift package completion-tool generate-zsh-script > ~/.oh-my-zsh/completions/_swift

But when I try auto-completion, e.g. for 'swift package', then I get the error swift:273: parse error near ()

Any suggestions?

Thanks in advance,
Marco

Looks to me that that issue is not specific to using the script in oh-my-zsh but rather that the ZSH completion script was incorrectly generated. Probably a bug of SPM.

This manually modified version of the generated script works for me: