feat: add global --r-bin cli argument#451
Conversation
|
I'm unsure how to create proper integration tests for this. If guidance can be provided would be happy to :) |
|
i think directionally this is fine - there is one bit of nuance i want to check around if we need to also do any RHOME or other shenanigans, but between a couple codex/claude risk assessment prompts i will push it through this weekend we can get this in |
There was a problem hiding this comment.
Pull request overview
Adds support for selecting an explicit R binary from the CLI (intended to enable workflows like rv sync using a caller-provided R installation path, per #447) by introducing a new RCommandLookup::Explicit mode and wiring it through CLI context creation.
Changes:
- Add global
--r-binCLI flag and plumb it intoContext::new(...)for sync-like commands. - Introduce
RCommandLookup::Explicit(RInstall)and updateContextinitialization to accept a pre-resolvedRInstall. - Add
RInstall::try_from_bin(...)helper to construct anRInstallfrom a binary path. - Add
.zed/settings.jsoneditor configuration file.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
src/r_finder.rs |
Adds RInstall::try_from_bin helper to construct an install from an explicit binary path. |
src/context.rs |
Adds RCommandLookup::Explicit(RInstall) and updates context initialization flow to use it. |
src/main.rs |
Introduces global --r-bin flag and passes explicit lookup into several command contexts. |
.zed/settings.json |
Adds Zed editor settings (not directly related to --r-bin). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| /// Path to an R binary to use instead of automatic discovery | ||
| #[clap(long, global = true)] | ||
| pub r_bin: Option<PathBuf>, |
There was a problem hiding this comment.
As indicated by #451 (comment) it's not clear how to do this.
| let r_lookup = match cli.r_bin { | ||
| Some(ref bin) => RCommandLookup::Explicit(RInstall::try_from_bin(bin)?), | ||
| None => RCommandLookup::Strict, |
There was a problem hiding this comment.
This is a fundamental misunderstanding of the rv codebase becuase RCommandLookup::Skip doesn't mean "doesn't use R" it means "use R from the path.
RCommandLookup::Skip => RInstall::default_from_path(),
|
I've reviewed Codex's review and I think it fundamentally misunderstands this PR. I'm happy to remove the .zed settings if requested. I view this to be akin to the existing Regarding integration tests, if some guidance can be provided that would be great: |
|
keeping the zed piece is fine - i agree it gives people using that editor the right LSP base |
This PR closes #447.
It works by adding a new
--r-binargument that adding a newRCommandLookup::Explicitvariant which, when provided, will (fallibly) create anRInstallfrom the binary path.Default behavior:

When specifying bin path:
Note that it properly creates the 4.6 subdirectory in addition to the default 4.5 version
waiting ⚡ ll rv/library total 0 drwxr-xr-x@ 4 josiahparry staff 128B May 5 10:40 . drwxr-xr-x@ 5 josiahparry staff 160B May 5 10:33 .. drwxr-xr-x@ 3 josiahparry staff 96B May 5 10:35 4.5 drwxr-xr-x@ 3 josiahparry staff 96B May 5 10:40 4.6