On Wed, Aug 24, 2016 at 9:54 PM, Michal Privoznik <mprivozn(a)redhat.com>
wrote:
On 20.08.2016 07:52, Nishith Shah wrote:
> This series introduces option completers and adds some minor improvements
> and fixes(not bugs per se, just better/sane behavior) in
vshReadlineParse.
>
> The first patch introduces the usage of option completers to
auto-complete
> arguments for a particular option.
>
> The second and third patches provide small improvements like completing
> the options of type VSH_OT_ARGV or VSH_OT_DATA, and to complete multiple
> options as well, if a previous option requires an argument, and that
> argument has been provided.
>
> Nishith Shah (3):
> virsh: Introduce usage of option completers to auto-complete arguments
> virsh: Allow data or argument options to be completed as well
> virsh: Complete multiple options when any one option requires data
>
> tools/vsh.c | 75 ++++++++++++++++++++++++++++++
++++++++++---------------------
> 1 file changed, 49 insertions(+), 26 deletions(-)
>
Okay, the patches look good to me. And I would merge them right away,
but there is a slight change in behaviour in virsh after your patch 2/3.
And you even describe it in the commit message:
Previously we had:
virsh # domstate<TAB><TAB>
just "--reason" was offered. Now, after the change "--domain" is
offered
for completion too. This is important so that we know which completer
should we call for the following input for instance:
virsh # domstate --domain<TAB><TAB>
In this case we want to offer list of domains.
I'd really value output from others whether this might work or is this
change something we don't wanna do?
Well, I couldn't really think of any reason why we were not showing the
options of type VSH_OT_ARGV and VSH_OT_DATA except maybe that we didn't
have support for further required completion and also the correctness of
auto-complete in such a case. I think now vshReadlineParse handles such
cases fairly well.
Nishith