[libvirt] libvirt zsh completions

Hi, FWIW, FYI, I've contributed completions for the commands part of libvirt to zsh upstream, here's a quick screenshot: $ virsh <TAB> zsh: do you wish to see all 222 possibilities (111 lines)? n $ virsh allocpages <TAB> --add --all --cellno --pagecount --pagesize $ virsh start <TAB> f23-test fedora-24-beta rhel-7-server $ virsh stop <TAB> f24-test rhel-6-server ubuntu-16.04 $ There's also support for the -c/--connect flag and selective completion support for the following (domains seen as an example above): + domains + interfaces + networks + devices + nwfilters + pools + secrets + snapshots + volumes Supported commands are: virsh virt-admin virt-host-validate virt-pki-validate virt-xml-validate Since virt-admin requires root/sudo, there are some additional security checks in zsh upstream to enable sudo for completions only by request. This will require the next zsh release. I've uploaded a version of these completions which uses sudo unconditionally to my fedorapeople.org page and it can be used by the adventurous already today (by placing it under /usr/share/zsh/*/functions/): https://myllynen.fedorapeople.org/_libvirt Cheers, -- Marko Myllynen

On Wed, Oct 05, 2016 at 12:29:59PM +0300, Marko Myllynen wrote:
Hi,
FWIW, FYI, I've contributed completions for the commands part of libvirt to zsh upstream, here's a quick screenshot:
$ virsh <TAB> zsh: do you wish to see all 222 possibilities (111 lines)? n $ virsh allocpages <TAB> --add --all --cellno --pagecount --pagesize $ virsh start <TAB> f23-test fedora-24-beta rhel-7-server $ virsh stop <TAB> f24-test rhel-6-server ubuntu-16.04 $
There's also support for the -c/--connect flag and selective completion support for the following (domains seen as an example above):
+ domains + interfaces + networks + devices + nwfilters + pools + secrets + snapshots + volumes
Supported commands are:
virsh virt-admin virt-host-validate virt-pki-validate virt-xml-validate
Since virt-admin requires root/sudo, there are some additional security checks in zsh upstream to enable sudo for completions only by request. This will require the next zsh release. I've uploaded a version of these completions which uses sudo unconditionally to my fedorapeople.org page and it can be used by the adventurous already today (by placing it under /usr/share/zsh/*/functions/):
That is great! Just for some individuals using zsh on gentoo, put it into /usr/share/zsh/site_functions/, that worked for me, 5.2/functions didn't work for me. Thanks!
Cheers,
-- Marko Myllynen
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list

On 10/05/2016 04:29 AM, Marko Myllynen wrote:
Hi,
FWIW, FYI, I've contributed completions for the commands part of libvirt to zsh upstream, here's a quick screenshot:
$ virsh <TAB> zsh: do you wish to see all 222 possibilities (111 lines)? n $ virsh allocpages <TAB> --add --all --cellno --pagecount --pagesize $ virsh start <TAB> f23-test fedora-24-beta rhel-7-server $ virsh stop <TAB> f24-test rhel-6-server ubuntu-16.04 $
There's also support for the -c/--connect flag and selective completion support for the following (domains seen as an example above):
+ domains + interfaces
... I'd STILL love to see the day when virsh itself offered a 'virsh completion foo bar...' command that gave context-sensitive completion results for 'virsh foo bar...'. The idea has been on the list for several years, and one student attempted (but failed) to do it for Google Summer of Code. With such a command in place, both bash and zsh completion functions become a LOT simpler (simply let virsh provide the list), and we aren't reinventing the wheel every time a new poster provides yet another completion engine in their favorite shell. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
participants (3)
-
Eric Blake
-
Marko Myllynen
-
Martin Kletzander