Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

cli: extend flags completion #5343

Open
2 of 3 tasks
ccoVeille opened this issue Jan 22, 2025 · 3 comments
Open
2 of 3 tasks

cli: extend flags completion #5343

ccoVeille opened this issue Jan 22, 2025 · 3 comments
Labels
enhancement New feature or improvement no decision No decision to fix or not

Comments

@ccoVeille
Copy link
Contributor

ccoVeille commented Jan 22, 2025

Welcome

Your feature request related to a problem? Please describe

I would like to be able to complete the flag values such as --out-format=git<TAB> or --enable-only=use<TAB>

Right now, only the flags are completed, not their values

Describe the solution you'd like

The tool uses cobra, we could use

https://pkg.go.dev/github.com/spf13/cobra#Command.RegisterFlagCompletionFunc

Describe alternatives you've considered

Define my own completions locally 😅

Additional context

I took a look at the code, most flag will be "easy"

Some might require a small refactoring because of the helpers defined in the code

Supporter

@ccoVeille ccoVeille added the enhancement New feature or improvement label Jan 22, 2025
@ccoVeille
Copy link
Contributor Author

ccoVeille commented Jan 22, 2025

I prepared this integration by improving the documentation of an existing method

https://pkg.go.dev/github.com/spf13/cobra@master#FixedCompletions

There is no need for latest cobra code to be tagged and used. I only worked on the documentation, that was a bit unclear

@ldez ldez added the no decision No decision to fix or not label Jan 22, 2025
@ldez ldez changed the title feature: improve CLI flags completion cli: improve flags completion Jan 22, 2025
@ldez ldez changed the title cli: improve flags completion cli: extend flags completion Jan 22, 2025
@ldez
Copy link
Member

ldez commented Jan 22, 2025

For the v2, I will change the linters management and the configuration, so unless you are not changing any existing code, I would prefer to not implement this for now.

@ccoVeille
Copy link
Contributor Author

ccoVeille commented Jan 22, 2025

OK. Thanks for the feedback.

I could open PRs for adding completion to flags where it's about adding a few lines of code per command.

And the ones that might require a refactoring could be left aside.

I think this small changes could bring a nice feature.

EDIT: I put my suggestion on hold now, I've seen the v2 refactoring suggested here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or improvement no decision No decision to fix or not
Projects
None yet
Development

No branches or pull requests

2 participants