]> git.ipfire.org Git - thirdparty/libvirt.git/commit
vsh: Allow double quotes imbalance for auto completion in vshCommandStringGetArg()
authorMichal Privoznik <mprivozn@redhat.com>
Thu, 7 Jan 2021 17:09:11 +0000 (18:09 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 26 Jan 2021 15:46:41 +0000 (16:46 +0100)
commitaad2262b9e5d2d2ffa07fbb2ce0d50a4a9c8e10a
tree2ec231f9b9e4186e12279301fc49ebde2e5c1611
parent22904b5702d52b1407f7c259c41cfa046049c06a
vsh: Allow double quotes imbalance for auto completion in vshCommandStringGetArg()

If user is trying to auto complete a value that contains a space,
they have two options: use backslash to escape space or use
quotes, like this:

  virsh # start --domain "domain with space<TAB>

However, in this case our tokenizer sees imbalance in (double)
quotes: there is a starting one that's missing its companion.
Well, that's obvious - user is still in process of writing the
command. What we need to do in this case is to ignore the
imbalance and return success (from the tokenizer) - readline will
handle closing the quote properly.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
tools/vsh.c