diff options
| author | Paul Buetow <paul@buetow.org> | 2026-05-24 00:51:28 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-05-24 00:51:28 +0300 |
| commit | f91ed7ace453b3266e386ec2c2e0792b90b599b0 (patch) | |
| tree | 079924da7a1643daca662c8870229ff4973f8ea2 | |
| parent | 03b99440b6d1921b01580fe1752760c5fbd626df (diff) | |
fix(repl): correct misleading comments in completer.go
- completer() is not used by readline; AutoCompleteAdapter is used instead
- AutoCompleteAdapter does not wrap or use the completer() function;
it maintains its own commands slice
- NewAutoCompleter does not use the completer function
| -rw-r--r-- | internal/repl/completer.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/internal/repl/completer.go b/internal/repl/completer.go index 9c50e12..acdd79a 100644 --- a/internal/repl/completer.go +++ b/internal/repl/completer.go @@ -11,7 +11,7 @@ import ( // It returns suggestions for commands that match the current word being typed. // The matching is case-insensitive. // -// This function is used by readline for tab completion. +// The function is used in tests; readline tab completion uses AutoCompleteAdapter instead. // // text: the current word being typed // Returns a slice of strings for matching built-in commands @@ -29,12 +29,13 @@ func completer(text string) []string { return suggestions } -// AutoCompleteAdapter adapts our completer function to the readline AutoCompleter interface +// AutoCompleteAdapter implements the readline AutoCompleter interface, +// providing tab-completion suggestions for built-in commands. type AutoCompleteAdapter struct { commands []string } -// NewAutoCompleter creates a readline auto-completer that uses the completer function. +// NewAutoCompleter creates a new AutoCompleteAdapter with the current list of built-in commands. func NewAutoCompleter() *AutoCompleteAdapter { return &AutoCompleteAdapter{ commands: Commands(), |
