MCPcopy Index your code
hub / github.com/REditorSupport/vscode-R / getCranUrl

Function getCranUrl

src/util.ts:318–329  ·  view source on GitHub ↗
(path: string = '', cwd?: string | URL)

Source from the content-addressed store, hash-verified

316// currently the CRAN root url is hardcoded, this could be replaced by reading
317// the url from config, R, or both
318export async function getCranUrl(path: string = '', cwd?: string | URL): Promise<string> {
319 const defaultCranUrl = 'https://cran.r-project.org/';
320 // get cran URL from R. Returns empty string if option is not set.
321 const baseUrl = await executeRCommand('cat(getOption(\'repos\')[\'CRAN\'])', cwd);
322 let url: string;
323 try {
324 url = new URL(path, baseUrl).toString();
325 } catch (e) {
326 url = new URL(path, defaultCranUrl).toString();
327 }
328 return url;
329}
330
331export async function getRVersion(cwd?: string | URL): Promise<string | undefined> {
332 return await executeRCommand('cat(as.character(getRversion()))', cwd);

Callers 4

installPackagesMethod · 0.90
updatePackagesMethod · 0.90
getPackagesMethod · 0.90
promptToInstallRPackageFunction · 0.85

Calls 1

executeRCommandFunction · 0.85

Tested by

no test coverage detected