pkg/terminal: Allow fuzzy searching tab completions (#2633)

This patch implements fuzzy searching for tab completions in the
terminal client. Under the hood it is using a trie data structure
(https://en.wikipedia.org/wiki/Trie) to perform very fast prefix / fuzzy
searches.
This commit is contained in:
Derek Parker
2021-08-05 10:55:27 -07:00
committed by GitHub
parent 985eca462c
commit 43d50202f3
11 changed files with 439 additions and 20 deletions

View File

@ -178,7 +178,7 @@ func withTestTerminalBuildFlags(name string, t testing.TB, buildFlags test.Build
func TestCommandDefault(t *testing.T) {
var (
cmds = Commands{}
cmd = cmds.Find("non-existant-command", noPrefix)
cmd = cmds.Find("non-existant-command", noPrefix).cmdFn
)
err := cmd(nil, callContext{}, "")
@ -194,7 +194,7 @@ func TestCommandDefault(t *testing.T) {
func TestCommandReplayWithoutPreviousCommand(t *testing.T) {
var (
cmds = DebugCommands(nil)
cmd = cmds.Find("", noPrefix)
cmd = cmds.Find("", noPrefix).cmdFn
err = cmd(nil, callContext{}, "")
)
@ -206,7 +206,7 @@ func TestCommandReplayWithoutPreviousCommand(t *testing.T) {
func TestCommandThread(t *testing.T) {
var (
cmds = DebugCommands(nil)
cmd = cmds.Find("thread", noPrefix)
cmd = cmds.Find("thread", noPrefix).cmdFn
)
err := cmd(nil, callContext{}, "")