浏览代码

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

donjuanplatinum 11 月之前
父节点
当前提交
f79998f626
共有 1 个文件被更改,包括 28 次插入3 次删除
  1. 28 3
      tools/change_rust_src.sh

+ 28 - 3
tools/change_rust_src.sh

@@ -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