Skip to content

fix(cmd): Hide suggestions if they are aliases#401

Merged
jedevc merged 3 commits into
prod-stagingfrom
craciunoiuc/fix-completions
Jul 8, 2026
Merged

fix(cmd): Hide suggestions if they are aliases#401
jedevc merged 3 commits into
prod-stagingfrom
craciunoiuc/fix-completions

Conversation

@craciunoiuc

@craciunoiuc craciunoiuc commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Closes: TOOL-1152
Closes: #399

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 registerCompletion wrapper 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_POINT and 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.

Comment thread internal/cmd/completion_test.go Outdated
@craciunoiuc craciunoiuc force-pushed the craciunoiuc/fix-completions branch from 6b2a7f0 to 6e4cb5d Compare July 6, 2026 19:25
Comment thread internal/cmd/completion_test.go Outdated
Comment thread internal/cmd/completion.go Outdated
@craciunoiuc craciunoiuc marked this pull request as draft July 7, 2026 15:07
@craciunoiuc craciunoiuc force-pushed the craciunoiuc/fix-completions branch from 6e4cb5d to de08da2 Compare July 8, 2026 12:52
@craciunoiuc craciunoiuc marked this pull request as ready for review July 8, 2026 12:56
@craciunoiuc craciunoiuc changed the title fix(cmd): Hide full suggestions if they are aliases fix(cmd): Hide suggestions if they are aliases Jul 8, 2026
@craciunoiuc

Copy link
Copy Markdown
Contributor Author

before you ask: no there is no global option to set this 😔

@craciunoiuc craciunoiuc requested a review from jedevc July 8, 2026 12:56

@jedevc jedevc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Big oof 🎉

Reviewed-by: Justin Chadwell <[email protected]>
Approved-by: Justin Chadwell <[email protected]>

@jedevc jedevc merged commit 740a4e9 into prod-staging Jul 8, 2026
10 checks passed
@jedevc jedevc deleted the craciunoiuc/fix-completions branch July 8, 2026 16:44
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.

Incorrect autocompletion command info in README

3 participants