mirror of
https://github.com/RubyMetric/chsrc.git
synced 2025-02-24 00:04:25 +08:00
Split rust out
This commit is contained in:
parent
3d58b6dcac
commit
b1aae3139f
@ -127,21 +127,6 @@ typedef struct {
|
||||
|
||||
|
||||
static SourceInfo
|
||||
/**
|
||||
* @time 2024-05-24 更新
|
||||
* @note 以下都支持稀疏索引,我们换源时都将默认添加 `sparse+`
|
||||
*/
|
||||
pl_rust_sources[] = {
|
||||
{&Upstream, NULL},
|
||||
{&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/"},
|
||||
{&Hust, "https://mirrors.hust.edu.cn/crates.io-index/"}
|
||||
},
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @time 2023-09-10 更新
|
||||
* @note 不太好换,且用户可能不多,我们暂时只给用户提供文档
|
||||
@ -746,7 +731,6 @@ wr_tex_sources[] = {
|
||||
#define def_sources_n(t) const size_t t##_sources_n = xy_arylen(t##_sources)
|
||||
|
||||
|
||||
def_sources_n(pl_rust);
|
||||
def_sources_n(pl_clojure);
|
||||
def_sources_n(pl_dotnet); def_sources_n(pl_dart); def_sources_n(pl_haskell);
|
||||
def_sources_n(pl_ocaml);
|
||||
|
33
src/chsrc.c
33
src/chsrc.c
@ -30,36 +30,7 @@
|
||||
#include "recipe/lang/lua.c"
|
||||
#include "recipe/lang/go.c"
|
||||
#include "recipe/lang/java.c"
|
||||
|
||||
|
||||
void
|
||||
pl_rust_getsrc (char *option)
|
||||
{
|
||||
chsrc_view_file ("~/.cargo/config.toml");
|
||||
}
|
||||
|
||||
/**
|
||||
* Rust 换源,参考:https://mirrors.tuna.tsinghua.edu.cn/help/crates.io-index/
|
||||
*/
|
||||
void
|
||||
pl_rust_setsrc (char *option)
|
||||
{
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (pl_rust);
|
||||
chsrc_confirm_source (&source);
|
||||
|
||||
const char* file = xy_strjoin (3,
|
||||
"[source.crates-io]\n"
|
||||
"replace-with = 'mirror'\n\n"
|
||||
|
||||
"[source.mirror]\n"
|
||||
"registry = \"sparse+", source.url, "\"");
|
||||
|
||||
chsrc_note2 (xy_strjoin (3, "请您手动写入以下内容到 ", xy_uniform_path ("~/.cargo/config.toml"), " 文件中:"));
|
||||
puts (file);
|
||||
chsrc_say_lastly (&source, ChsrcTypeManual);
|
||||
}
|
||||
|
||||
#include "recipe/lang/rust.c"
|
||||
|
||||
|
||||
void
|
||||
@ -1812,7 +1783,7 @@ wr_anaconda_setsrc (char *option)
|
||||
|
||||
|
||||
/************************************** Begin Target Matrix ****************************************/
|
||||
def_target(pl_rust); def_target(pl_dart); def_target(pl_ocaml);
|
||||
def_target(pl_dart); def_target(pl_ocaml);
|
||||
def_target(pl_r); def_target(pl_julia);
|
||||
def_target_noget (pl_clojure);
|
||||
def_target_noget (pl_dotnet);
|
||||
|
45
src/recipe/lang/rust.c
Normal file
45
src/recipe/lang/rust.c
Normal file
@ -0,0 +1,45 @@
|
||||
/**
|
||||
* @time 2024-05-24 更新
|
||||
* @note 以下都支持稀疏索引,我们换源时都将默认添加 `sparse+`
|
||||
*/
|
||||
static SourceInfo
|
||||
pl_rust_sources[] = {
|
||||
{&Upstream, NULL},
|
||||
{&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/"},
|
||||
{&Hust, "https://mirrors.hust.edu.cn/crates.io-index/"}
|
||||
};
|
||||
def_sources_n(pl_rust);
|
||||
|
||||
|
||||
void
|
||||
pl_rust_getsrc (char *option)
|
||||
{
|
||||
chsrc_view_file ("~/.cargo/config.toml");
|
||||
}
|
||||
|
||||
/**
|
||||
* Rust 换源,参考:https://mirrors.tuna.tsinghua.edu.cn/help/crates.io-index/
|
||||
*/
|
||||
void
|
||||
pl_rust_setsrc (char *option)
|
||||
{
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (pl_rust);
|
||||
chsrc_confirm_source (&source);
|
||||
|
||||
const char* file = xy_strjoin (3,
|
||||
"[source.crates-io]\n"
|
||||
"replace-with = 'mirror'\n\n"
|
||||
|
||||
"[source.mirror]\n"
|
||||
"registry = \"sparse+", source.url, "\"");
|
||||
|
||||
chsrc_note2 (xy_strjoin (3, "请您手动写入以下内容到 ", xy_uniform_path ("~/.cargo/config.toml"), " 文件中:"));
|
||||
puts (file);
|
||||
chsrc_say_lastly (&source, ChsrcTypeManual);
|
||||
}
|
||||
|
||||
def_target(pl_rust);
|
Loading…
x
Reference in New Issue
Block a user