mirror of
https://github.com/RubyMetric/chsrc.git
synced 2025-02-02 14:41:18 +08:00
Add support for r
This commit is contained in:
parent
e9b262e521
commit
b9c57d54d2
|
@ -1,6 +1,6 @@
|
|||
# chsrc
|
||||
|
||||
全平台命令行换源工具,**目标支持 Linux, Windows, macOS, BSD 等所有操作系统,飞腾,龙芯等所有CPU**。
|
||||
全平台命令行换源工具,**目标支持 Linux, Windows, macOS, BSD 等所有操作系统,龙芯、申威、飞腾、兆芯、海光等所有CPU**。
|
||||
|
||||
若有不支持的情况,请提交issue。
|
||||
|
||||
|
@ -41,7 +41,7 @@ set <target> <mirror> # 换源,指定使用某镜像站
|
|||
- [ ] `chsrc set rust` 或 `chsrc set cargo` 或 `chsrc crate`
|
||||
- [ ] `chsrc set java` 或 `chsrc set maven` 或 `chsrc set mvn` 或 `chsrc gradle`
|
||||
|
||||
- [ ] `chsrc set r` 或 `chsrc set cran`
|
||||
- [x] `chsrc set r` 或 `chsrc set cran`
|
||||
- [ ] `chsrc set julia`
|
||||
|
||||
## 操作系统
|
||||
|
|
19
chsrc.c
19
chsrc.c
|
@ -627,16 +627,23 @@ pl_java_setsrc (char* option)
|
|||
}
|
||||
|
||||
|
||||
/* TODO: 暂未实现 */
|
||||
|
||||
void
|
||||
pl_r_getsrc (char* option)
|
||||
{
|
||||
// char* cmd = "npm config get registry";
|
||||
// system(cmd);
|
||||
char* cmd = NULL;
|
||||
if(xy_on_windows) {
|
||||
cmd = "type %USERPROFILE%\\Documents\\.Rprofile";
|
||||
} else {
|
||||
cmd = "cat ~/.Rprofile";
|
||||
}
|
||||
chsrc_logcmd(cmd);
|
||||
system(cmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* R 换源,参考:https://help.mirrors.cernet.edu.cn/CRAN/
|
||||
* TODO: bioconductor 换源
|
||||
*/
|
||||
void
|
||||
pl_r_setsrc (char* option)
|
||||
|
@ -655,12 +662,12 @@ pl_r_setsrc (char* option)
|
|||
const char* file = xy_strjoin (3, "options(\"repos\" = c(CRAN=\"", source.url, "\"))" );
|
||||
|
||||
char* cmd = NULL;
|
||||
// TODO: 待确认,Windows 下是否也是该文件
|
||||
if (xy_on_windows)
|
||||
cmd = xy_strjoin(3, "echo ", file, " >> %USERPROFILE%/.Rprofile");
|
||||
cmd = xy_strjoin(3, "echo ", file, " >> %USERPROFILE%/Documents/.Rprofile");
|
||||
else
|
||||
cmd = xy_strjoin(3, "echo ", file, " >> ~/.Rprofile");
|
||||
|
||||
chsrc_logcmd(cmd);
|
||||
system(cmd);
|
||||
chsrc_say_thanks(&source);
|
||||
}
|
||||
|
@ -931,7 +938,7 @@ target_info
|
|||
pl_dotnet_target = {pl_dotnet_setsrc, NULL, pl_dotnet_sources, pl_dotnet_sources_n},
|
||||
pl_java_target = {pl_java_setsrc, NULL, pl_java_sources, pl_java_sources_n},
|
||||
pl_php_target = {pl_php_setsrc, pl_php_getsrc, pl_php_sources, pl_php_sources_n},
|
||||
pl_r_target = {pl_r_setsrc, NULL, pl_r_sources, pl_r_sources_n},
|
||||
pl_r_target = {pl_r_setsrc, pl_r_getsrc, pl_r_sources, pl_r_sources_n},
|
||||
pl_julia_target = {pl_julia_setsrc, NULL, pl_julia_sources, pl_julia_sources_n};
|
||||
|
||||
|
||||
|
|
3
chsrc.h
3
chsrc.h
|
@ -189,7 +189,7 @@ pl_perl_sources[] = {
|
|||
|
||||
|
||||
/**
|
||||
* 2023-08-30 更新
|
||||
* 2023-09-04 更新
|
||||
*
|
||||
* TODO: 速度未经测试,请R用户协助
|
||||
*/
|
||||
|
@ -197,6 +197,7 @@ pl_r_sources[] = {
|
|||
{&Sjtug_Zhiyuan, "https://mirrors.sjtug.sjtu.edu.cn/cran/"},
|
||||
{&Ali, "https://mirrors.aliyun.com/CRAN/"},
|
||||
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/CRAN/"},
|
||||
{&Sustech, "https://mirrors.sustech.edu.cn/CRAN"},
|
||||
{&Bfsu, "https://mirrors.bfsu.edu.cn/CRAN/"},
|
||||
{&Bjtu, "https://mirror.bjtu.edu.cn/cran/"},
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue
Block a user