]> xenbits.xensource.com Git - libvirt.git/commit
vsh: Simplify condition for calling completer callback
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 2 Feb 2021 10:52:27 +0000 (11:52 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 10 Feb 2021 10:51:59 +0000 (11:51 +0100)
commit9b005b19673b6e8bc4b30c81c87a450a57c8e410
tree24b7ba3a9102306a570c8381d6dda29152f668d1
parentb1eab47c2dc1a665710d16ff52ad051dc7f69f77
vsh: Simplify condition for calling completer callback

The way we currently call completer callbacks is that if we've
found --option that user wants to complete value for and it has
callback set then the callback is called.

And just before that, if no --option to have the value completed
is found or is found and is of boolean type then a list of
--option is generated (for given command).

But these two conditions can never be true at the same time
because boolean type of --options do not accept values. Therefore
the calling of completer callback can be promoted onto the same
level as the --option list generation.

This means that merging of two lists can be dropped to and
completer callback can store its retval directly into @list (but
as shown earlier one of the string lists to merge is always
empty).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
tools/vsh.c