Status of completions for shells other than bash (e.g. zsh, fish)?

Snap currently supports bash completions, and the documentation states:

…in the future that same mechanism may be enabled in other shells as well.

What is the status of completions for other shells? Is this likely to be something we can expect in the short- to medium-term future?

I searched for zsh completion and search for fish completion on this forum but did not find any existing status.

I also searched for zsh and searched for fish on https://bugs.launchpad.net/snapcraft but did not find anything relevant.

Downstream user request: https://github.com/twpayne/chezmoi/issues/660

Many thanks for any information!
Tom

For zsh at least using a plugin such as https://github.com/3v1n0/zsh-bash-completions-fallback will handle it, doing the same in Fish is just matter of exercise.

Completion support for zsh is part of the snapd package since 2.46.

Sorry, the way I asked the question was not clear.

I want to included zsh and fish completions to my snaps. I can include bash completions by using completer keyword in my snapcraft.yaml. When will I be able to include zsh and fish completions as well?

Ah, sorry, I was confused.

At the moment only bash is supported, but since there is demand, it’s worth researching the topic a bit more. I have some idea about putting things at the right place for zsh, but I have no clue about fish. Would appreciate any input there.

fish completion files typically have the name <app>.fish and are normally stored in the directory /usr/share/fish/completions.

zsh completion files, typically have the name _<app> and are normally stored in the directory /usr/share/zsh/vendor-completions on Debian-like distributions. RedHat-like distributions use /usr/share/zsh/functions. The leading underscore in the filename is important: without it zsh will not automatically add the completion.

1 Like

Any updates on this?

At least on Arch:

$ pacman -Ql snapd |grep _snap
snapd /usr/share/zsh/site-functions/_snap

On Ubuntu there’s a /usr/share/zsh/vendor-completions/_snap file.

Thanks for the response. The question was about shell completions for installed snaps, not shell completion for snap itself. For example, if I install package foo with snap install foo, will it also install zsh and fish completions for foo?