Fix try interactive selector appearing on bashrc re-source#4877
Merged
dhh merged 1 commit intobasecamp:devfrom Mar 4, 2026
Merged
Fix try interactive selector appearing on bashrc re-source#4877dhh merged 1 commit intobasecamp:devfrom
dhh merged 1 commit intobasecamp:devfrom
Conversation
`try init` defines a shell function named `try`. On subsequent `source ~/.bashrc`, `try init` calls the function (interactive selector) instead of the binary. Adding `command` bypasses the function and always calls the binary. Fixes basecamp#4876 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
if this ain't the cleanest PR I have ever seen 🚀 |
Merged
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.
Summary
try initdefines a shell function namedtry. On subsequentsource ~/.bashrc, the shell function shadows the binary, sotry initlaunches the interactive selector instead of outputting the function definition. Addingcommandbypasses the function and always invokes the binary.Details
The one-word change (
command tryinstead oftry) is a standard bash pattern —commandskips shell functions/aliases and runs the external binary directly. This is the same reasoncommand -vis used in the guard condition above it.The other
eval "$(... init ...)"lines in this file (mise, starship, zoxide) don't have this problem because they don't define a shell function with the same name as the binary.Test plan
tryworks normallysource ~/.bashrc— verify no interactive selector popuptry— verify interactive selector still works as expectedFixes #4876
Also reported by umaru-sama on Discord (2026-03-01).
🤖 Generated with Claude Code