Skip to content

fix(autocomplete): filter out hidden commands when args is empty - #34

Open
Adityakk9031 wants to merge 1 commit into
context-dot-dev:mainfrom
Adityakk9031:fix/autocomplete-hide-internal-commands
Open

Adityakk9031 wants to merge 1 commit into
context-dot-dev:mainfrom
Adityakk9031:fix/autocomplete-hide-internal-commands

Conversation

@Adityakk9031

Copy link
Copy Markdown

Summary

In \internal/autocomplete/autocomplete.go\ (\getAllPossibleCompletions), when \len(args) == 0\ (e.g. when typing \context-dev \ and pressing TAB), the code iterated through all
oot.Commands\ without checking \child.Hidden.

This leaked internal and maintenance commands (such as __complete\ and @completion) into user-facing shell autocompletions.

Solution

Added \if !child.Hidden\ check when \len(args) == 0, matching the behavior in the non-empty args path.

Tests

  • Updated \TestGetCompletions_HiddenCommand\ in \internal/autocomplete/autocomplete_test.go\ to verify that hidden commands are excluded both when a prefix is provided and when \�rgs\ is empty.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant