mirror of
https://github.com/RubyMetric/chsrc
synced 2026-10-25 17:36:32 +08:00
使用 XySeq_t 列举镜像站
This commit is contained in:
3 files changed
+59
-47
No files matched your search
+9
-9
@@ -97,16 +97,16 @@ chsrc_register_contributors ()
|
||||
|
||||
|
||||
void
|
||||
cli_print_available_mirrors ()
|
||||
cli_print_all_mirror_sites ()
|
||||
{
|
||||
{
|
||||
char *msg = ENGLISH ? "To specify a source, use chsrc set " : "指定使用某源,请使用 chsrc set ";
|
||||
say (bdblue(xy_strcat (3, msg, "<target>", " <code>\n")));
|
||||
println (bdblue(xy_strcat (3, msg, "<target>", " <code>\n")));
|
||||
}
|
||||
|
||||
{
|
||||
char *msg = ENGLISH ? "Available Mirror Sites: \n" : "可用镜像站: \n";
|
||||
say (bdgreen(msg));
|
||||
println (bdgreen(msg));
|
||||
}
|
||||
|
||||
{
|
||||
@@ -115,13 +115,13 @@ cli_print_available_mirrors ()
|
||||
char *msg3 = ENGLISH ? "Mirror Name" : "镜像站";
|
||||
char *format = ENGLISH ? " %-13s%-28s%-35s%s\n" : " %-13s%-33s%-42s%s\n";
|
||||
printf (format, "code", msg1, msg2, msg3);
|
||||
say ("--------- -------------- ------------------------------------- ---------------------");
|
||||
println ("--------- -------------- ------------------------------------- ---------------------");
|
||||
}
|
||||
|
||||
for (int i = 0; i < xy_c_array_len (chsrc_available_mirrors); i++)
|
||||
for (int i=1; i<=xy_seq_len(ProgStore.mirror_sites); i++)
|
||||
{
|
||||
MirrorSite_t *mir = chsrc_available_mirrors[i];
|
||||
printf ("%-14s%-18s%-41s ", mir->code, mir->abbr, mir->site); say (mir->name);
|
||||
MirrorSite_t *mir = xy_seq_at(ProgStore.mirror_sites, i);
|
||||
printf (" %-13s%-28s%-35s%s\n", mir->code, mir->abbr, mir->site, mir->name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -929,7 +929,7 @@ main (int argc, char const *argv[])
|
||||
{
|
||||
if (argc < cli_arg_Target_pos)
|
||||
{
|
||||
cli_print_available_mirrors ();
|
||||
cli_print_all_mirror_sites ();
|
||||
br();
|
||||
cli_print_supported_targets ();
|
||||
}
|
||||
@@ -939,7 +939,7 @@ main (int argc, char const *argv[])
|
||||
if ( xy_streql (target, "mirrors")
|
||||
|| xy_streql (target, "mirror"))
|
||||
{
|
||||
cli_print_available_mirrors ();
|
||||
cli_print_all_mirror_sites ();
|
||||
return Exit_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -132,6 +132,7 @@ ProgStatus =
|
||||
/* Global Program Store */
|
||||
struct
|
||||
{
|
||||
XySeq_t *mirror_sites;
|
||||
XySeq_t *pl;
|
||||
XySeq_t *os;
|
||||
XySeq_t *wr;
|
||||
@@ -139,6 +140,7 @@ struct
|
||||
}
|
||||
ProgStore =
|
||||
{
|
||||
.mirror_sites = NULL,
|
||||
.pl = NULL,
|
||||
.os = NULL,
|
||||
.wr = NULL,
|
||||
@@ -221,6 +223,8 @@ chsrc_init_framework ()
|
||||
xy_init ();
|
||||
|
||||
ProgStore.contributors = xy_map_new ();
|
||||
|
||||
ProgStore.mirror_sites = xy_seq_new ();
|
||||
ProgStore.pl = xy_seq_new ();
|
||||
ProgStore.os = xy_seq_new ();
|
||||
ProgStore.wr = xy_seq_new ();
|
||||
|
||||
+46
-38
@@ -6,7 +6,7 @@
|
||||
* | @BingChunMoLi
|
||||
* |
|
||||
* Created On : <2023-09-01>
|
||||
* Major Revision : 5
|
||||
* Major Revision : 6
|
||||
* Last Modified : <2026-08-02>
|
||||
* ------------------------------------------------------------*/
|
||||
|
||||
@@ -108,6 +108,51 @@
|
||||
void
|
||||
chsrc_init_menu ()
|
||||
{
|
||||
/* @sync https://github.com/RubyMetric/chsrc/wiki */
|
||||
#define add(t) xy_seq_push(ProgStore.mirror_sites, &t)
|
||||
|
||||
/* ------------------------ 教育网(通用镜像站) ------------------------ */
|
||||
add(MirrorZ);
|
||||
add(Tuna);
|
||||
add(Sjtug_Zhiyuan); add(Sjtug_Siyuan);
|
||||
add(Bfsu);
|
||||
add(Ustc);
|
||||
add(Zju);
|
||||
add(Jlu);
|
||||
add(Lzuoss);
|
||||
add(Pku);
|
||||
add(Bjtu);
|
||||
add(Sustech);
|
||||
add(Nju);
|
||||
add(Xjtu);
|
||||
add(Hust); add(Iscas); add(Hit); add(Scau);
|
||||
add(NJTech); add(Nyist); add(Sdu); add(Qlu);
|
||||
add(Cqupt); add(Cqu); add(Neosoft);
|
||||
|
||||
/* ------------------------ 商业公司(通用镜像站) ------------------------ */
|
||||
add(Ali); // add(Ali_ECS_VPC); add(Ali_ECS_classic);
|
||||
add(Tencent); // add(Tencent_Intra);
|
||||
add(Huawei); add(HuaweiCDN);
|
||||
add(Volcengine);
|
||||
add(Netease);
|
||||
add(Sohu);
|
||||
|
||||
add(Api7); add(Fit2Cloud); add(DaoCloud);
|
||||
|
||||
|
||||
/* ------------------------ 专用镜像站 ------------------------ */
|
||||
add(RubyChina); // Ruby China 镜像站实际上已于2026年7月21日停用,但由于其是持续数十年的由社区维护驱动的镜像站,我们保留表示致敬
|
||||
add(EmacsChina);
|
||||
add(NpmMirror); add(GoProxyIO); add(GoProxyCN); add(RsProxyCN); add(FlutterCN);
|
||||
/* 暂不支持 &NugetOrg */
|
||||
|
||||
|
||||
/* ------------------------ chsrc 内部实现 ------------------------ */
|
||||
/* 不要列出 UpstreamProvider 和 UserDefinedProvider */
|
||||
#undef add
|
||||
|
||||
|
||||
|
||||
#define add(t) xy_seq_push(ProgStore.pl, &pl_##t##_target); (&pl_##t##_target)->preludefn = pl_##t##_prelude
|
||||
add (ruby);
|
||||
add (python_group);
|
||||
@@ -188,40 +233,3 @@ chsrc_init_menu ()
|
||||
// Internal Target 不会由用户使用,需要特殊对待
|
||||
pl_js_nodejs_binary_target.preludefn = pl_js_nodejs_binary_prelude;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @sync https://github.com/RubyMetric/chsrc/wiki
|
||||
*/
|
||||
static MirrorSite_t*
|
||||
chsrc_available_mirrors[] = {
|
||||
|
||||
/* ------------------------ 教育网(通用镜像站) ------------------------ */
|
||||
&MirrorZ, &Tuna, &Sjtug_Zhiyuan, &Sjtug_Siyuan, &Bfsu, &Ustc, &Zju, &Jlu, &Lzuoss, &Pku, &Bjtu, &Sustech, &Nju, &Xjtu,
|
||||
|
||||
&Hust, &Iscas, &Hit, &Scau,
|
||||
&NJTech, &Nyist, &Sdu, &Qlu,
|
||||
&Cqupt, &Cqu, &Neosoft,
|
||||
|
||||
|
||||
/* ------------------------ 商业公司(通用镜像站) ------------------------ */
|
||||
&Ali, // &Ali_ECS_VPC, &Ali_ECS_classic,
|
||||
&Tencent, // &Tencent_Intra,
|
||||
&Huawei, &HuaweiCDN,
|
||||
&Volcengine,
|
||||
&Netease,
|
||||
&Sohu,
|
||||
|
||||
&Api7, &Fit2Cloud, &DaoCloud,
|
||||
|
||||
|
||||
/* ------------------------ 专用镜像站 ------------------------ */
|
||||
&RubyChina, // Ruby China 镜像站实际上已于2026年7月21日停用,但由于其是持续数十年的由社区维护驱动的镜像站,我们保留表示致敬
|
||||
&EmacsChina, &NpmMirror, &GoProxyIO, &GoProxyCN, &RsProxyCN, &FlutterCN,
|
||||
/* 暂不支持 &NugetOrg */
|
||||
|
||||
|
||||
/* ------------------------ chsrc 内部实现 ------------------------ */
|
||||
/* 不要列出 &UpstreamProvider 和 &UserDefinedProvider */
|
||||
};
|
||||
Reference in new issue
Block a user