Skip to content

feat: add global --r-bin cli argument#451

Open
JosiahParry wants to merge 1 commit into
A2-ai:mainfrom
JosiahParry:feat/r-bin
Open

feat: add global --r-bin cli argument#451
JosiahParry wants to merge 1 commit into
A2-ai:mainfrom
JosiahParry:feat/r-bin

Conversation

@JosiahParry
Copy link
Copy Markdown

This PR closes #447.

It works by adding a new --r-bin argument that adding a new RCommandLookup::Explicit variant which, when provided, will (fallibly) create an RInstall from the binary path.

Default behavior:
image

When specifying bin path:

image

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

@JosiahParry
Copy link
Copy Markdown
Author

I'm unsure how to create proper integration tests for this. If guidance can be provided would be happy to :)

@dpastoor
Copy link
Copy Markdown
Member

dpastoor commented May 9, 2026

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

Copy link
Copy Markdown
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

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-bin CLI flag and plumb it into Context::new(...) for sync-like commands.
  • Introduce RCommandLookup::Explicit(RInstall) and update Context initialization to accept a pre-resolved RInstall.
  • Add RInstall::try_from_bin(...) helper to construct an RInstall from a binary path.
  • Add .zed/settings.json editor 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.

Comment thread src/r_finder.rs
Comment thread src/r_finder.rs
Comment thread src/main.rs
Comment thread src/main.rs
Comment on lines +40 to +42
/// Path to an R binary to use instead of automatic discovery
#[clap(long, global = true)]
pub r_bin: Option<PathBuf>,
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As indicated by #451 (comment) it's not clear how to do this.

Comment thread .zed/settings.json
Comment thread src/context.rs
Comment thread src/main.rs
Comment on lines +351 to +353
let r_lookup = match cli.r_bin {
Some(ref bin) => RCommandLookup::Explicit(RInstall::try_from_bin(bin)?),
None => RCommandLookup::Strict,
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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(),

@JosiahParry
Copy link
Copy Markdown
Author

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 .vscode/ folder. Without it developing in Zed will require updating the .zed settings every time a new PR is done—which, I can understand.

Regarding integration tests, if some guidance can be provided that would be great:
#451 (comment)

@dpastoor
Copy link
Copy Markdown
Member

keeping the zed piece is fine - i agree it gives people using that editor the right LSP base

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.

feat: rv sync to support provided R path

3 participants