]> xenbits.xensource.com Git - libvirt.git/commit
vsh: Rework logic for picking which argument is to be completed
authorPeter Krempa <pkrempa@redhat.com>
Tue, 12 Mar 2024 07:29:00 +0000 (08:29 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 25 Apr 2024 12:13:19 +0000 (14:13 +0200)
commit1818cbda3bf404c55764b4e1a80aebaac960774b
tree2c2ddbc3513d4c23c7195d65b8c86842261c3774
parentb41bde935d2d504534bdb53e7cf6376add0e8dc9
vsh: Rework logic for picking which argument is to be completed

Currently the code decides which option to complete by looking into the
input string and trying to infer it based on whether we are at the
end position as we truncate the string to complete to the current cursor
position.

That basically means that only the last-parsed option will be up for
completion.

Replace the logic by remembering which is the last option rather than
using two different position checks and base the completion decision on
that and the actual value of the last argument (see comment).

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
tools/vsh.c
tools/vsh.h