Skip to content

Implement --exact-match Flag for bundle info / show / open#9489

Open
OughtPuts wants to merge 1 commit intoruby:masterfrom
OughtPuts:ho/implement-exact-match-bundle-flag
Open

Implement --exact-match Flag for bundle info / show / open#9489
OughtPuts wants to merge 1 commit intoruby:masterfrom
OughtPuts:ho/implement-exact-match-bundle-flag

Conversation

@OughtPuts
Copy link
Copy Markdown
Contributor

@OughtPuts OughtPuts commented Apr 17, 2026

What was the end-user or developer problem that led to this PR?

bundle info, bundle show, and bundle open currently 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 like bundle info rack can end up matching another gem such as crack, 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-match flag to bundle info, bundle show, and bundle 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:

  • Added --exact-match as a Thor option for all three commands.
  • Kept Bundler::CLI::Common.select_spec unchanged to keep the change light-touch.
  • Added a small shared helper in Bundler::CLI::Common that decides whether to call select_spec with regex matching enabled or disabled based on the new flag.
  • Updated the command manpages for bundle info, bundle show, and bundle open.

Tests were added to cover both behaviors for all three commands:

  • --exact-match returns the exact spec without prompting
  • omitting the flag keeps the existing fuzzy-match behavior

Make sure the following tasks are checked

@OughtPuts OughtPuts marked this pull request as draft April 17, 2026 16:16
@OughtPuts OughtPuts changed the title Implement exact-match flag for bundle info / show / open Implement --exact-match Flag for bundle info / show / open Apr 17, 2026
@OughtPuts OughtPuts force-pushed the ho/implement-exact-match-bundle-flag branch from c7563b4 to 303aab7 Compare April 17, 2026 16:33
@OughtPuts OughtPuts marked this pull request as ready for review April 17, 2026 16:34
@OughtPuts OughtPuts force-pushed the ho/implement-exact-match-bundle-flag branch from 303aab7 to d761f8a Compare April 27, 2026 12:56
@OughtPuts OughtPuts force-pushed the ho/implement-exact-match-bundle-flag branch from d761f8a to 4086d85 Compare April 27, 2026 13:09
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.

1 participant