Implement --exact-match Flag for bundle info / show / open#9489
Open
OughtPuts wants to merge 1 commit intoruby:masterfrom
Open
Implement --exact-match Flag for bundle info / show / open#9489OughtPuts wants to merge 1 commit intoruby:masterfrom
--exact-match Flag for bundle info / show / open#9489OughtPuts wants to merge 1 commit intoruby:masterfrom
Conversation
exact-match flag for bundle info / show / open--exact-match Flag for bundle info / show / open
c7563b4 to
303aab7
Compare
303aab7 to
d761f8a
Compare
d761f8a to
4086d85
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was the end-user or developer problem that led to this PR?
bundle info,bundle show, andbundle opencurrently fall back to regex matching when the provided gem name is not an exact match. That can produce surprising results for short or partial names. For example, a command likebundle info rackcan end up matching another gem such ascrack, or prompt with multiple fuzzy matches when the user intended to target a single exact gem name.This PR addresses: #9441
This PR adds a way for users to opt out of that fuzzy behavior when they want strict lookup semantics.
What is your fix for the problem, implemented in this PR?
This PR adds a new
--exact-matchflag tobundle info,bundle show, andbundle open.When the flag is provided, these commands skip the existing regex fallback and only resolve a gem when its name exactly matches the user input. When the flag is not provided, the existing behavior is preserved, including fuzzy matching and interactive disambiguation when multiple gems match.
Implementation details:
--exact-matchas a Thor option for all three commands.Bundler::CLI::Common.select_specunchanged to keep the change light-touch.Bundler::CLI::Commonthat decides whether to callselect_specwith regex matching enabled or disabled based on the new flag.bundle info,bundle show, andbundle open.Tests were added to cover both behaviors for all three commands:
--exact-matchreturns the exact spec without promptingMake sure the following tasks are checked