]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: cli: apply spelling fixes for known commands before listing them
authorWilly Tarreau <w@1wt.eu>
Fri, 12 Mar 2021 17:24:46 +0000 (18:24 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 12 Mar 2021 18:09:19 +0000 (19:09 +0100)
commitb736458bfa07e49746574a467c9c27e26e2d9f9e
tree4634889086097db634ce0742eea8d9c85159f340
parentb96a74cbfd0e8cfc755d36cfa5ee8c4d95e89dda
MEDIUM: cli: apply spelling fixes for known commands before listing them

Entering "show tls" would still emit 35 entries. By measuring the distance
between all unknown words and the candidates, we can sort them and pick the
10 most likely candidates. This works reasonably well, as now "show tls"
only proposes "show tls-keys", "show threads", "show pools" and "show tasks".

If the distance is still too high or if a word is missing, the whole
prefix list continues to be dumped, thus "show" alone will still report
the entire list of commands beginning with "show".

It's still impossible to skip a word, for example "show conn" will not
propose "show servers conn" because the distance is calculated for each
word individually. Some changes to the distance calculation to support
updating an existing map could easily address this. But this is already
a great improvement.
include/haproxy/cli-t.h
src/cli.c