]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: cli: improve fuzzy matching to work on all remaining words at once
authorWilly Tarreau <w@1wt.eu>
Mon, 15 Mar 2021 09:00:29 +0000 (10:00 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 15 Mar 2021 09:33:45 +0000 (10:33 +0100)
commita9aa628703bc9d98d1974bc175e3cff8c12cab4c
treed36bb7cb9aeedb7aa038c6ccfa761c831c62da95
parent714c4c14d1cde8a9027c9806f74821b08f8a03ad
MINOR: cli: improve fuzzy matching to work on all remaining words at once

Till now the fuzzy matching would only work on the same number of words,
but this doesn't account for commands like "show servers conn" which
involve 3 words and were not proposed when entering only "show conn".
Let's improve the situation by building the two fingerprints separately
for the correct keyword sequence and the entered one, then compare them.
This can result in slightly larger variations due to the different string
lengths but is easily compensated for. Thanks to this, we can now see
"show servers conn" when entering "show conn", and the following choices
are relevant to correct typos:

- "show foo"
   show sess [id] : report the list of current sessions or dump this session
   show info      : report information about the running process [desc|json|typed]*
   show env [var] : dump environment variables known to the process
   show fd [num] : dump list of file descriptors in use
   show pools     : report information about the memory pools usage

- "show stuff"
   show sess [id] : report the list of current sessions or dump this session
   show info      : report information about the running process [desc|json|typed]*
   show stat      : report counters for each proxy and server [desc|json|no-maint|typed|up]*
   show fd [num] : dump list of file descriptors in use
   show tasks     : show running tasks

- "show stafe"
   show sess [id] : report the list of current sessions or dump this session
   show stat      : report counters for each proxy and server [desc|json|no-maint|typed|up]*
   show fd [num] : dump list of file descriptors in use
   show table [id]: report table usage stats or dump this table's contents
   show tasks     : show running tasks

- "show state"
   show stat      : report counters for each proxy and server [desc|json|no-maint|typed|up]*
   show servers state [id]: dump volatile server information (for backend <id>)

It's still visible that the shorter ones continue to easily match, such
as "show sess" not having much in common with "show foo" but what matters
is that the best candidates are definitely relevant. Probably that listing
them in match order would further help.
src/cli.c