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
<html style="direction: ltr;"> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> <style type="text/css">body p { margin-bottom: 0cm; margin-top: 0pt; } </style> </head> <body style="direction: ltr;" bidimailui-charset-is-forced="true" bgcolor="#FFFFFF" text="#000000"> <br> <br> <div class="moz-cite-prefix">On 03/24/2016 03:49 AM, Eric Blake wrote:<br> </div> <blockquote cite="mid:56F3247E.9040702@redhat.com" type="cite"> <pre wrap="">On 03/23/2016 04:57 PM, Mohsen Pahlevanzadeh wrote: </pre> <blockquote type="cite"> <pre wrap="">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 </pre> </blockquote> <pre wrap=""> 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. </pre> </blockquote> Yes, I believe.It can report as feature request.<br> </body> </html>
On 23.03.2016 23:57, 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 > > > --Best regards > Mohsen >There's a GSoC project idea aiming exactly at this: http://wiki.libvirt.org/page/Google_Summer_of_Code_2016#Making_virsh_more_bash_like Consider applying if applicable. Michal