canonical / multipass

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

ZSH completion #1509

Open flying-sausages opened 4 years ago

flying-sausages commented 4 years ago

What are you trying to do? Complete commands on ZSH, which is now default on MacOS and heavily used amongst powerusers.

What's your proposed solution? Create new file for ZSH completion

Additional context Compared to .bashrc, there is a lot of config management systems but they all agree on allowing user modifications to .zshrc

linux-china commented 3 years ago

Please visit https://github.com/linux-china/cli-completion , and use cli-completion to generate completion for bash,zsh,fish by multpass.yaml

Saviq commented 3 years ago

@linux-china does this allow for dynamic completions? Like introspecting output from a command to produce the available values for completion?

Saviq commented 3 years ago

@flying-sausages, all - you can add this to your .zshrc:

autoload bashcompinit
bashcompinit
source /Library/Application\ Support/com.canonical.multipass/Resources/completions/bash/multipass
Saviq commented 3 years ago

Ah, but it won't work for multipass shell <TAB>... :/

$ multipass shell _multipass_instances:11: command not found: _get_comp_words_by_ref
_multipass_instances:11: command not found: _get_comp_words_by_ref
_multipass_instances:11: command not found: _get_comp_words_by_ref
                               multipass shell
nikitastupin commented 2 years ago

Hi there! I recently started working on zsh completion for multipass. You may track the progress at https://github.com/nikitastupin/incubator/blob/main/zsh/functions/_multipass. I will submit a Pull Request to this repository as soon as the file is more or less ready.

By the way, thanks for the multipass project! ❤️