rig icon indicating copy to clipboard operation
rig copied to clipboard

Allow passing R arguments to `rig run`

Open AdrienLeGuillou opened this issue 1 year ago • 10 comments

Hi,

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

something like rig run -- --no-save

Thanks

AdrienLeGuillou avatar Sep 19 '24 09:09 AdrienLeGuillou

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

gaborcsardi avatar Sep 19 '24 09:09 gaborcsardi

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

AdrienLeGuillou avatar Sep 19 '24 09:09 AdrienLeGuillou

Specifying --no-save does make a difference:

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

klmr avatar Sep 19 '24 09:09 klmr

weirdly not in my case

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

let me check on another computer

AdrienLeGuillou avatar Sep 19 '24 09:09 AdrienLeGuillou

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

AdrienLeGuillou avatar Sep 19 '24 09:09 AdrienLeGuillou

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

gaborcsardi avatar Sep 19 '24 09:09 gaborcsardi

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

AdrienLeGuillou avatar Sep 19 '24 10:09 AdrienLeGuillou

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 avatar Sep 19 '24 12:09 klmr

@klmr Yeah, I like that.

gaborcsardi avatar Sep 19 '24 12:09 gaborcsardi

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).

TymekDev avatar Oct 18 '24 06:10 TymekDev