fix(cmd): Hide suggestions if they are aliases#401
Merged
Conversation
Signed-off-by: Cezar Craciunoiu <[email protected]>
There was a problem hiding this comment.
Pull request overview
This PR adjusts the CLI’s tab-completion integration to hide redundant alias suggestions in root (and nested) command listings, while keeping aliases available when the user is typing a prefix. It introduces a small wrapper around kong-completion registration, adds targeted unit tests, and updates the README completion examples.
Changes:
- Add
registerCompletionwrapper to filter completion output and hide child-command aliases for “bare tab” completions. - Wire the new completion registration into the root command initialization, preserving the completion exit behavior.
- Add unit tests for parsing
COMP_LINE/COMP_POINTand for the alias-hiding completion behavior; update README completion invocation examples.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| README.md | Updates shell completion script generation examples. |
| internal/cmd/root.go | Switches from direct kongcompletion.Register to the new registerCompletion wrapper (with explicit exit handling). |
| internal/cmd/completion.go | New implementation that captures/filters completion output to hide alias entries in root/nested listings. |
| internal/cmd/completion_test.go | New tests covering COMP_LINE parsing and alias-hiding behavior during completion. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
6b2a7f0 to
6e4cb5d
Compare
jedevc
reviewed
Jul 7, 2026
Signed-off-by: Cezar Craciunoiu <[email protected]>
6e4cb5d to
de08da2
Compare
Signed-off-by: Cezar Craciunoiu <[email protected]>
Contributor
Author
|
before you ask: no there is no global option to set this 😔 |
jedevc
approved these changes
Jul 8, 2026
jedevc
left a comment
Member
There was a problem hiding this comment.
Big oof 🎉
Reviewed-by: Justin Chadwell <[email protected]>
Approved-by: Justin Chadwell <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes: TOOL-1152
Closes: #399