Skip to content

Conversation

@daeho-ro
Copy link
Member

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run 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, click and clap, 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 :cobra and re-organize the order of shell parameter formats alphabetically.

Copy link
Member

@MikeMcQuaid MikeMcQuaid left a 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!

Base automatically changed from feature/typer-completion to main December 21, 2025 08:32
@daeho-ro daeho-ro marked this pull request as ready for review December 21, 2025 08:44
Copilot AI review requested due to automatic review settings December 21, 2025 08:44
Copy link
Contributor

Copilot AI left a 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 :cobra shell parameter format with default shells including PowerShell
  • Refactored shell parameter generation logic into private completion_shell_parameter method
  • Reorganized documentation examples alphabetically by format type

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@daeho-ro daeho-ro force-pushed the feature/improve-completions branch 2 times, most recently from 36aa804 to c5d7dca Compare December 21, 2025 11:01
@daeho-ro
Copy link
Member Author

I have noticed that the powershell change can break the current status, so keep it same as original.

@daeho-ro daeho-ro force-pushed the feature/improve-completions branch from c5d7dca to 92455a0 Compare December 21, 2025 11:01
commands: T.any(Pathname, String),
base_name: T.nilable(String),
shells: T::Array[Symbol],
shells: T.nilable(T::Array[Symbol]),
Copy link
Member

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.

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.

3 participants