mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
vshCommandStringParse: Allow retrieving partial result
In the future, this function is going to be called from vshReadlineParse() to provide parsed input for completer callbacks. The idea is to allow the callbacks to provide more specific data. For instance, for the following input: virsh # domifaddr --domain fedora --interface <TAB><TAB> the --interface completer callback is going to be called. Now, it is more user friendly if the completer offers only those interfaces found in 'fedora' domain. But in order to do that it needs to be able to retrieve partially parsed result. Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
@@ -1335,7 +1335,7 @@ vshAdmParseArgv(vshControl *ctl, int argc, char **argv)
|
||||
ctl->imode = false;
|
||||
if (argc - optind == 1) {
|
||||
vshDebug(ctl, VSH_ERR_INFO, "commands: \"%s\"\n", argv[optind]);
|
||||
return vshCommandStringParse(ctl, argv[optind]);
|
||||
return vshCommandStringParse(ctl, argv[optind], NULL);
|
||||
} else {
|
||||
return vshCommandArgvParse(ctl, argc - optind, argv + optind);
|
||||
}
|
||||
@@ -1555,7 +1555,7 @@ main(int argc, char **argv)
|
||||
#if WITH_READLINE
|
||||
add_history(ctl->cmdstr);
|
||||
#endif
|
||||
if (vshCommandStringParse(ctl, ctl->cmdstr))
|
||||
if (vshCommandStringParse(ctl, ctl->cmdstr, NULL))
|
||||
vshCommandRun(ctl, ctl->cmd);
|
||||
}
|
||||
VIR_FREE(ctl->cmdstr);
|
||||
|
||||
Reference in New Issue
Block a user