r-lib/rig

Allow passing R arguments to `rig run`

Opened this issue · 10 comments

Hi,

is there a way to pass R arguments like --no-save to rig run?

something like rig run -- --no-save

Thanks

AFAICT it never saves the data, so you don't need --no-save. Which arguments would you like to use in particular?

I do get the Save workspace image? [y/n/c]: prompt when quitting with Ctrl-D (or the signal sent by iron.nvim) and as well with just q().

I can make an alias

  q <- function(save="no", ...)  quit(save = save, ...)

in my .Rprofile but that does not change the behavior on Ctrl-D

klmr commented

Specifying --no-save does make a difference:

$ rig run
[…]
> q()
Save workspace image? [y/n/c]: ^D
$ R --no-save
[…]
> q()
[quits without prompt]

weirdly not in my case

I > R --no-save
[..]
> q()
Save workspace image? [y/n/c]: n

let me check on another computer

ok apparently that has to do with an alias malfunctioning on my end.
Very sorry for that

Oh, right, so you are running it without any arguments? Then it would indeed make sense to be able to pass some arguments....

Yes, I guess having a way to pass argument into rig run to the sub call (R, RScript, etc) could be useful.

I suggested rig run -- --no-save as it reminds me of cargo run a_project -- arguments_to_the_project

klmr commented

A modest proposal: make rig run an alias for R --no-save --no-restore instead of currently just R, to shed some historical ballast (the default R settings of saving/restoring globalenv is daft).

@klmr Yeah, I like that.

I wouldn't mind having either --vanilla or --no-init-file and --no-site-file. I find it useful when working in a renv project, but wanting do something outside the limited library (e.g. check docs of a package I have installed globally).