
On 01/11/2018 11:52 AM, Martin Kletzander wrote:
On Tue, Jan 02, 2018 at 06:11:53PM +0100, Michal Privoznik wrote:
Technically, this is a v2 of [1], but this implements the feature from different angle and therefore it's a start of new series.
What's implemented? =================== Auto completion for both interactive and non-interactive virsh/virt-admin.
Known limitations ================= Currently, just options completers work. I mean, to bring up list of domains you have to:
virsh # start --domain <TAB><TAB>
Doing bare:
virsh # start <TAB><TAB>
brings up list of --options. With the new approach implemented here it should be easy to implement this. But that can be saved for later.
How to test this? =================
Interactive completion should work out of the box. Just make sure you're connected. Completers don't connect! You certainly don't want ssh's 'Password:' prompt show on <TAB><TAB>, do you? Non-interactive completers do connect, but in order to avoid any password prompts, /dev/stdin is closed before anything else is done. In order to test it, just:
libvirt.git $ source tools/bash-completion/vsh
Now, bash completion should work:
libvirt.git $ ./tools/virsh -c qemu:///system start --domain <TAB><TAB>
Notes =====
As usual, you can find all the patches on my github [2]. I've tried to work in all the review suggestions from v1. Due to changes in design (reusing parse code instead of duplicating it) not all suggestions were possible to work in though.
Michal
ACK to all if you fix the two possible NULL problems (04/18 and 08/18).
Thank you guys. I've pushed these. Now all that's left to do is to write the completer callbacks, but that should be fairly easy now O:-) Michal