Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix CompletionFunc implementation #2234

Merged
merged 2 commits into from
Feb 16, 2025

Conversation

ccoVeille
Copy link
Contributor

  • chore: add missing non-regression test for completions
  • fix: completion helper retro-compatibility

This PR is about this

The new type CompletionFunc could lead to a regression.
This commit adds a test to ensure that the completion function is correctly

The tests are currently failing. This is expected as the fix is not yet implemented.

Signed-off-by: ccoVeille <3875889+ccoVeille@users.noreply.github.com>
Signed-off-by: ccoVeille <3875889+ccoVeille@users.noreply.github.com>
@ccoVeille
Copy link
Contributor Author

I provided a separate commit so anyone reviewing could fetch and check.

I covered the possible issue such as

type UserCompletionTypeHelper func(cmd *Command, args []string, toComplete string) ([]string, ShellCompDirective)

type UserCompletionTypeAliasHelper = func(cmd *Command, args []string, toComplete string) ([]string, ShellCompDirective)

Please review @marckhouzam @thaJeztah @tassa-yoniso-manasi-karoto

Thanks

@marckhouzam
Copy link
Collaborator

I'm reviewing this now. Thanks for the quick fix @ccoVeille !

Copy link
Contributor

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

Copy link
Collaborator

@marckhouzam marckhouzam left a comment

Choose a reason for hiding this comment

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

Very nice tests!
LGTM

Thanks!

@marckhouzam marckhouzam added this to the 1.9.1 milestone Feb 16, 2025
@marckhouzam marckhouzam merged commit a97f9fd into spf13:main Feb 16, 2025
20 checks passed
thaJeztah added a commit to thaJeztah/cli that referenced this pull request Feb 16, 2025
Using the branch from spf13/cobra#2234

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztah
Copy link
Contributor

Tested locally and build works with this PR (failed with v1.9.0); just pushed a draft PR to also have it run in CI docker/cli#5829

Copy link
Collaborator

@jpmcb jpmcb left a comment

Choose a reason for hiding this comment

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

Late comment: LGTM

@ccoVeille ccoVeille deleted the fix-completion branch February 16, 2025 19:23
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants