Closed ebenp closed 2 years ago
I'm partial to still using tidyverse rather than base R in functions for the sake of readability... Here's my suggestion. The cli alert in is_citrix()
is maybe not necessary, but the standalone current_r_location()
function might be useful at some point too (could use a better name though).
is_citrix <- function() {
x <- Sys.info()["nodename"]
cli::cli_alert_info("R appears to be running on: {current_r_location()}")
stringr::str_detect(x, "APP\\d+")
}
current_r_location <- function() {
x <- Sys.info()["nodename"]
if(stringr::str_detect(x, "APP\\d+")) return("shitrix") else
if(stringr::str_detect(x, "rstudio")) return("linux") else
return("local")
}
Tidyverse is fine. I'm thinking we probably want a TRUE / FALSE from is_citrix. I think the APP name would be useful though. Maybe FALSE or the APP name?
Eben
Eben Pendleton (he/him/his) | Project Scientist Tel: 207.800.3808 45 Exchange Street, Suite 200 | Portland | ME 04101 @.*** | www.integral-corp.com
[cid:integral-logo_bb8ba854-3124-462b-8a66-06670ee4325c.jpg] From: Jonathan Zadra @.> Sent: Wednesday, May 11, 2022 2:50 PM To: IntegralEnvision/integral-private @.> Cc: Eben Pendleton @.>; Author @.> Subject: Re: [IntegralEnvision/integral-private] Add on_citrix function (Issue #13)
[CAUTION: External email. Think before you click links or open attachments.]
I'm partial to still using tidyverse rather than base R in functions for the sake of readability... Here's my suggestion. The cli alert in is_citrix() is maybe not necessary, but the standalone function might be useful at some point too.
is_citrix <- function() {
x <- Sys.info()["nodename"]
cli::cli_alert_info("R appears to be running on: {current_r_location()}")
stringr::str_detect(x, "APP\d+")
}
current_r_location <- function() {
x <- Sys.info()["nodename"]
if(stringr::str_detect(x, "APP\d+")) return("shitrix") else
if(stringr::str_detect(x, "rstudio")) return("linux") else
return("local")
}
— Reply to this email directly, view it on GitHubhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_IntegralEnvision_integral-2Dprivate_issues_13-23issuecomment-2D1124174468&d=DwMCaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=gSHwxelS22ZqidOSMsNwtQmM0boS6SXeFon3b8F1mQY&m=8RoJGaYC8PDB5ZSzX-Yfo-jWJmDzB8dKp1JyNwkNFHs&s=Tvyucv8leyrOtP1GhxUY1hfZivmexyMr4h_BXC-4XNo&e=, or unsubscribehttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_AA7EDM76RQCYAYR4WCBMOVDVJP6O5ANCNFSM5VVBHWEQ&d=DwMCaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=gSHwxelS22ZqidOSMsNwtQmM0boS6SXeFon3b8F1mQY&m=8RoJGaYC8PDB5ZSzX-Yfo-jWJmDzB8dKp1JyNwkNFHs&s=NK87x2OlY7P7YGpndUyC1jUdBLqsfFMS3-LLZ1w8fNk&e=. You are receiving this because you authored the thread.Message ID: @.**@.>>
is_citrix() returns a logical.
Create function to detect if on Citrix. Possible syntax is to find the nodename and see if it starts with APP grepl("^APP", Sys.info()[[grep("nodename", names(Sys.info()))]])