canonical / multipass

Multipass orchestrates virtual Ubuntu instances
https://multipass.run
GNU General Public License v3.0
7.76k stars 642 forks source link

[cli] Tab completion for zsh / tcsh / fish #3436

Open hartmutobendorf opened 6 months ago

hartmutobendorf commented 6 months ago

Describe the bug Tab completion on Ubuntu only works for bash.

To Reproduce How, and what happened?

  1. zsh
  2. multipass <TAB>
  3. lists directory contents

Expected behavior show commands like for bash

I would suggest adding completion scripts for zsh, tcsh and fish. https://snapcraft.io/docs/tab-completion suggests this is possible referencing https://github.com/snapcore/snapd/blob/master/data/completion/bash/complete.sh

georgeliao commented 6 months ago

Hi @hartmutobendorf

Thanks for pointing this out. Indeed, multipass tab completion is only supported on bash and not on zsh. Being able to do that on zsh definitely can be a good enhancement. As to how to do that, I have a quick look at the documentation you suggested, it looks like the completion.sh can refer to the bash completion file and reuse that. This can be one way and a quick way to do it if it works as expected. However, it only fixes it on Linux and the macos probably will need a standard zsh completion script.

Anyway, we need to have a discussion within the team regarding how to do it and when we can do it.

Thanks a lot for the advice.