[libvirt-users] virsh and bash_complete

Eric Blake eblake at redhat.com
Wed Mar 23 23:19:26 UTC 2016


On 03/23/2016 04:57 PM, Mohsen Pahlevanzadeh wrote:
> Dear All,
> 
> I downloaded the attachment file and activate for bash_complete, It can give you 
> the following output:
> # virsh net-
> net-autostart    net-dhcp-leases  net-info         net-undefine
> net-create       net-dumpxml      net-list         net-update
> net-define       net-edit         net-name         net-uuid
> net-destroy      net-event        net-start
> 

Thanks; but that's fragile. You have to constantly maintain the bash
script to keep up with additions to virsh.

Much better would be adding a 'virsh complete' command, which takes the
remaining command line arguments, and provides the context-sensitive
completion list that best fits what the rest of the command line would
be looking for if done in isolation.  Then the bash completion wrapper
would merely forward the current command line to 'virsh complete', and
you'd only ever have to write the bash wrapper once, rather than
maintaining it through each virsh addition.

At one point, a student attempted work on this for Google Summer of Code
(I think 2014?), but didn't get anywhere.  It is still a GREAT idea, if
someone wants to tackle it.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 604 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20160323/b9180677/attachment.sig>


More information about the libvirt-users mailing list