增加rust sparse稀疏索引选项 (#826)

This commit is contained in:
donjuanplatinum 2024-05-18 00:22:38 +08:00 committed by GitHub
parent bde08cded6
commit f79998f626
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,8 +1,33 @@
# 更换Rust镜像源
echo -e "[source.crates-io] \n \
echo "正在为rust换源"
echo "bash change_rust_src.sh --sparse以使用稀疏索引"
sparse="false"
while true; do
if [ -z "$1" ]; then
break;
fi
case "$1" in
"--sparse")
echo "使用稀疏索引"
sparse=""
;;
esac
shift 1
done
if [ -z ${sparse} ]; then
echo -e "[source.crates-io] \n \
registry = \"https://github.com/rust-lang/crates.io-index\" \n \
\n \
replace-with = 'tuna' \n \
[source.tuna] \n \
registry = \"sparse+https://mirrors.tuna.tsinghua.edu.cn/crates.io-index/\" \n \
" > ~/.cargo/config
else
echo -e "[source.crates-io] \n \
registry = \"https://github.com/rust-lang/crates.io-index\" \n \
\n \
replace-with = 'tuna' \n \
[source.tuna] \n \
registry = \"https://mirrors.tuna.tsinghua.edu.cn/git/crates.io-index.git\" \n \
" > ~/.cargo/config
" > ~/.cargo/config
fi