-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
feature: improve completion default shells, add :cobra format
#21293
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
base: main
Are you sure you want to change the base?
Conversation
MikeMcQuaid
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good thanks again!
There was a problem hiding this comment.
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 refactors the generate_completions_from_executable method to improve code maintainability and adds support for the :cobra shell completion format. The refactoring extracts the shell parameter generation logic into a private method and introduces format-specific default shell lists.
Key Changes:
- Added
:cobrashell parameter format with default shells including PowerShell - Refactored shell parameter generation logic into private
completion_shell_parametermethod - Reorganized documentation examples alphabetically by format type
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
36aa804 to
c5d7dca
Compare
|
I have noticed that the powershell change can break the current status, so keep it same as original. |
c5d7dca to
92455a0
Compare
| commands: T.any(Pathname, String), | ||
| base_name: T.nilable(String), | ||
| shells: T::Array[Symbol], | ||
| shells: T.nilable(T::Array[Symbol]), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be nicer to keep this non-nilable and assign in the method definition.
brew lgtm(style, typechecking and tests) with your changes locally?This is based on #21287, .
While working on shell completion support, I noticed that when the same packages e.g.
cobra,clickandclap, are used across mutiple formulae, providing parameter formats with default shells makes the user experience much simpler.So the goal of this PR is to improve readability by extracting some logic into private methods, and to simplify the DSL by providing more predefined types like
:cobraand re-organize the order of shell parameter formats alphabetically.