Add rust, java, nuget, php sources

This commit is contained in:
Aoran Zeng 2023-08-30 22:27:08 +08:00
parent fff012f62a
commit 014c34ece1
3 changed files with 81 additions and 24 deletions

View File

@ -27,14 +27,14 @@ chsrc pip # 或 chsrc python
chsrc npm # 或 chsrc nodejs chsrc npm # 或 chsrc nodejs
chsrc cpan # 或 chsrc perl chsrc cpan # 或 chsrc perl
chsrc cran # 或 chsrc r
chsrc julia
chsrc go chsrc go
chsrc cargo # 或 chsrc rust 或 chsrc crate chsrc cargo # 或 chsrc rust 或 chsrc crate
chsrc maven chsrc maven # 或 chsrc java 或 chsrc gradle
chsrc gradle
chsrc dotnet chsrc dotnet
chsrc composer # 或 chsrc php
chsrc cran # 或 chsrc r
chsrc julia
# 操作系统 # 操作系统
chsrc ubuntu chsrc ubuntu

24
chsrc.c
View File

@ -160,34 +160,40 @@ os_ubuntu_chsrc (char* option)
} }
#define chsrcfunc(func) (const char const*)func #define chsrcfunc(func) (const char const*)func
static const char const static const char const
*pl_ruby[] = {"gem", "ruby", "rb", NULL, chsrcfunc(pl_ruby_chsrc) }, *pl_ruby[] = {"gem", "ruby", "rb", NULL, chsrcfunc(pl_ruby_chsrc) },
*pl_python[] = {"pip", "python", "py", "pypi", NULL, chsrcfunc(pl_python_chsrc)}, *pl_python[] = {"pip", "python", "py", "pypi", NULL, chsrcfunc(pl_python_chsrc)},
*pl_nodejs[] = {"npm", "node", "nodejs", "js", NULL}, *pl_nodejs[] = {"npm", "node", "nodejs", "js", NULL},
*pl_perl[] = {"perl", "cpan", NULL}, *pl_perl[] = {"perl", "cpan", NULL},
*pl_php[] = {"php", "composer", NULL},
*pl_cran[] = {"r", "cran", NULL},
*pl_rust[] = {"rust", "cargo", "crate", "crates", NULL}, *pl_rust[] = {"rust", "cargo", "crate", "crates", NULL},
*pl_go[] = {"go", "golang", "goproxy", NULL}, *pl_go[] = {"go", "golang", "goproxy", NULL},
*pl_dotnet[] = {"nuget","net", "dotnet", ".net", NULL}, *pl_dotnet[] = {"nuget","net", "dotnet", ".net", NULL},
*pl_maven[] = {"maven", NULL}, *pl_java[] = {"maven", NULL},
*pl_gradle[] = {"gradel",NULL}, *pl_php[] = {"php", "composer", NULL},
*pl_cran[] = {"r", "cran", NULL},
*pl_julia[] = {"julia", NULL}, *pl_julia[] = {"julia", NULL},
*os_ubuntu[] = {"ubuntu", NULL, chsrcfunc(os_ubuntu_chsrc)},
// Java暂时需要直接指定包管理器
// pl_java
**pl_packagers[] = { **pl_packagers[] = {
pl_ruby, pl_python, pl_nodejs, pl_perl, pl_php, pl_cran, pl_ruby, pl_python, pl_nodejs, pl_perl,
pl_rust, pl_go, pl_dotnet, pl_maven, pl_gradle, pl_julia pl_rust, pl_go, pl_dotnet, pl_java, pl_php,
pl_cran, pl_julia
}, },
*os_ubuntu[] = {"ubuntu", NULL, chsrcfunc(os_ubuntu_chsrc)},
**os_packagers[] = { **os_packagers[] = {
os_ubuntu os_ubuntu
}; };
#undef chsrcfunc #undef chsrcfunc
static const char const* static const char const*
usage[] = { usage[] = {
"chsrc: Change Source " Chsrc_Version " by RubyMetric\n", "chsrc: Change Source " Chsrc_Version " by RubyMetric\n",

67
chsrc.h
View File

@ -33,7 +33,8 @@ mirror_info
Ustc = {"USTC", "中国科学技术大学开源镜像站"}, Ustc = {"USTC", "中国科学技术大学开源镜像站"},
// 速度暂时处于10位以后但是可用的源 // 速度暂时处于10位以后但是可用的源
Nju = {"NJU", "南京大学开源镜像站"}; Nju = {"NJU", "南京大学开源镜像站"},
Cqu = {"CQU", "重庆大学开源软件镜像站"};
// 大型公司 // 大型公司
@ -49,8 +50,8 @@ mirror_info
mirror_info mirror_info
RubyChina = {"RubyChina", "Ruby China 社区"}, RubyChina = {"RubyChina", "Ruby China 社区"},
GoProxyCN = {"Goproxy.cn", "七牛云 Goproxy.cn"}, GoProxyCN = {"Goproxy.cn", "七牛云 Goproxy.cn"},
GoProxyIO = {"GOPROXY.IO", "GOPROXY.IO"}; GoProxyIO = {"GOPROXY.IO", "GOPROXY.IO"},
NugetOrg = {"NuGet Org", "https://www.nuget.org/"};
typedef struct { typedef struct {
@ -126,7 +127,7 @@ pl_perl_sources[] = {
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/CPAN/"}, {&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/CPAN/"},
{&Bfsu, "https://mirrors.bfsu.edu.cn/CPAN/"}, {&Bfsu, "https://mirrors.bfsu.edu.cn/CPAN/"},
{&Bjtu, "https://mirror.bjtu.edu.cn/cpan/"}, {&Bjtu, "https://mirror.bjtu.edu.cn/cpan/"},
{&Lzuoss "https://mirror.lzu.edu.cn/CPAN/"} {&Lzuoss, "https://mirror.lzu.edu.cn/CPAN/"}
}, },
@ -144,7 +145,6 @@ pl_r_sources[] = {
}, },
/** /**
* 2023-08-30 * 2023-08-30
* *
@ -160,13 +160,11 @@ pl_julia_sources[] = {
}, },
/** /**
* 2023-08-30 * 2023-08-30
* *
* TODO: 1. Go用户协助 * TODO: 1. Go用户协助
* 2. * 2.
*/ */
pl_go_sources[] = { pl_go_sources[] = {
{&Ali, "https://mirrors.aliyun.com/goproxy/"}, {&Ali, "https://mirrors.aliyun.com/goproxy/"},
@ -175,6 +173,59 @@ pl_go_sources[] = {
}, },
/**
* 2023-08-30
*
* TODO: 1. Rust用户协助
* 2.
*/
pl_rust_sources[] = {
{&Sjtug_Zhiyuan, "https://mirrors.sjtug.sjtu.edu.cn/crates.io-index/"},
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/crates.io-index/"},
{&Bfsu, "https://mirrors.bfsu.edu.cn/crates.io-index/"},
{&Ustc, "https://mirrors.ustc.edu.cn/crates.io-index/"},
{&Cqu, "https://mirrors.cqu.edu.cn/crates.io-index/"}
},
/**
* 2023-08-30
*
* TODO: 1. Java用户协助
* 2.
* 3.
*/
pl_java_sources[] = {
{&Ali, "https://maven.aliyun.com/repository/public/"}
},
/**
* 2023-08-30
*
*
*
* TODO: 1. Java用户协助
* 2.
* 3.
*/
pl_nuget_sources[] = {
{&NugetOrg, "https://www.nuget.org/api/v2/"}
},
/**
* 2023-08-30
*
* TODO: 1. PHP用户协助
* 2.
* 3.
*/
pl_php_sources[] = {
{&Ali, "https://mirrors.aliyun.com/composer/"}
};