mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-21 20:15:17 +00:00
6ba61373b7
The aim of vshCompleterFilter() is to take a string list and a prefix and remove all strings from the list that don't have the desired prefix. The function is used to filter out those strings returned by a completer callback that don't correspond with user's (partial) input. For instance, domain name completer virshDomainNameCompleter() returns all domain names and then vshCompleterFilter() refines the list so that only domains with correct prefix of their name are offered to user. This was a design choice - it allows us to have shorter completers as they do not have to copy the list filtering over and over. Having said all of that, it may happen that a completer does not return anything (e.g. there is no domain in requested state, virsh is not connected and thus completer exited early, etc.). In that case, the string list is NULL and vshCompleterFilter() can simply return early. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>