[PATCH 08/12] vsh: Deduplicate filtering in vshReadlineOptionsGenerator()
Michal Privoznik
mprivozn at redhat.com
Wed Feb 10 10:54:24 UTC 2021
On 2/9/21 5:00 PM, Jonathon Jongsma wrote:
> On Thu, 4 Feb 2021 15:13:33 +0100
> Michal Privoznik <mprivozn at redhat.com> wrote:
>
>> This is what we do for completer callbacks: we let them generate
>> all possible outputs ignoring any partial input (e.g. prefix of a
>> domain name) and then use vshCompleterFilter() to filter out
>> those strings which don't fit the partial input (prefix).
>>
>> The same algorithm is implemented in
>> vshReadlineOptionsGenerator() even though a bit differently.
>> There is no need to have the same code twice.
>
> I think this might be clearer stated a bit differently. For example, if
> I'm understanding correctly, a suggested alternate commit message:
>
> Completer callbacks generate all possible outputs ignoring any partial
> input (e.g. prefix of a domain name) and then use vshCompleterFilter() to
> filter out those strings which don't fit the partial input (prefix).
>
> In contrast, vshReadlineOptionsGenerator() does some internal filtering and
> only generates completions that match a given prefix. Rather than treating
> these scenarios differently, simply generate all possible options and
> filter them all at the end.
Yup, this sounds way better. Thanks!
Michal
More information about the libvir-list
mailing list