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

Stop command aliases and flag aliases from being suggested in shell completion #1882

Merged
merged 2 commits into from Apr 29, 2024

Conversation

bartekpacia
Copy link
Contributor

@bartekpacia bartekpacia commented Apr 3, 2024

What type of PR is this?

  • bug fix

Which issue(s) this PR fixes:

This PR fixes #1875. It is the second try, now targeting v3. The first try, targeting v2, was in #1876.

Release Notes

- Command aliases and flag aliases are no longer included in shell completions (#1882)

@bartekpacia bartekpacia requested a review from a team as a code owner April 3, 2024 22:41
@bartekpacia bartekpacia changed the title shell completion: do not suggest aliases Stop command aliases and flag aliases from being suggested in shell completion Apr 3, 2024
Copy link
Contributor

@Juneezee Juneezee left a comment

Choose a reason for hiding this comment

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

LGTM.

@dearchap
Copy link
Contributor

@Juneezee didnt we say we want a runtime config flag to enable this behavior ?

@bartekpacia
Copy link
Contributor Author

Hi @dearchap. From my perspective as an avid user of the terminal and fan of CLI tools, I think shortcuts of commands being hidden during shell completion is more common (and personally, I prefer it this way also). Especially that this is targeting v3 so some small minor changes are OK. I am all for adding a flag to control this behavior.

Of course, you are the maintainer and the one to make the call.

We could also add an environmental variable that all CLI tools built with urfave/cli would respect. Perhaps SHELL_COMPLETION_SHOW_ALIASES? Think of it as something similar to the NO_COLOR env var, which is very widely respected.

So, if SHELL_COMPLETION_SHOW_ALIASES was to 1 or true, aliases of commands/flags would be shown. Maybe we could also get other popular CLI packages (such as e.g. Cobra) to adopt it? I'd be happy to know what you (maintainers) think about it :)

@dearchap
Copy link
Contributor

Yeah that makes sense

@meatballhat
Copy link
Member

@dearchap Did you want to see the introduction of the SHELL_COMPLETION_SHOW_ALIASES environment variable switch that @bartekpacia described within this PR, or is merging now and adding in a follow-up acceptable?

@dearchap
Copy link
Contributor

Merging now is acceptable

@meatballhat meatballhat merged commit 8996374 into urfave:main Apr 29, 2024
11 checks passed
@bartekpacia bartekpacia deleted the v3/fix/completion_aliases branch April 29, 2024 01:30
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.

Shell completion is suggesting aliases
4 participants