diff options
| -rw-r--r-- | internal/repl/help.go | 5 | ||||
| -rw-r--r-- | internal/repl/help_test.go | 11 |
2 files changed, 13 insertions, 3 deletions
diff --git a/internal/repl/help.go b/internal/repl/help.go index 5192085..1aaec09 100644 --- a/internal/repl/help.go +++ b/internal/repl/help.go @@ -537,8 +537,11 @@ func GetCompletionTopics() []string { // Add "categories" as a special topic topics = append(topics, "categories") - // Add all operator names + // Add all operator names (skip "help" itself — no need to complete help help) for op, t := range helpByTopic { + if op == "help" { + continue + } topics = append(topics, op) seen[op] = true // Add aliases diff --git a/internal/repl/help_test.go b/internal/repl/help_test.go index ca77462..9813ebb 100644 --- a/internal/repl/help_test.go +++ b/internal/repl/help_test.go @@ -134,8 +134,8 @@ func TestGetCompletionTopicsIncludesAliases(t *testing.T) { expectedAliases := []string{"exit", "calc", "gt", "lt", "categories"} for _, expected := range expectedAliases { found := false - for _, t := range topics { - if t == expected { + for _, topic := range topics { + if topic == expected { found = true break } @@ -144,6 +144,13 @@ func TestGetCompletionTopicsIncludesAliases(t *testing.T) { t.Errorf("GetCompletionTopics() missing alias/topic %q", expected) } } + + // "help" itself should NOT be in completion topics + for _, topic := range topics { + if topic == "help" { + t.Error("GetCompletionTopics() should not include 'help' itself") + } + } } func TestGetCompletionTopicsIsSorted(t *testing.T) { |
