Jan-Philipp Litza

Autocompletion for virsh in zsh

You probably know libvirt, the virtualization control API, and it’s great command line utility virsh. Well, I was long enough disappointed by the lack of autocompletion for this command in zsh and thus having to type out all domain names, arguments, switches etc., that I wrote the autocompletion myself.

I must admit, not even I am satisfied with the result right now, but it works and that’s what counts, right? I never wrote any autocompletion stuff for zsh before and had to steal the bits from various other completion files, including ip (because it also has the command subcommand structure) and iptables (because it generates some completions live, for example chain names and rules, just like I wanted with domain names).

Anyway, I just wrapped it up a git repo so anybody interested can use it as well.