File tree Expand file tree Collapse file tree 3 files changed +46
-3
lines changed
Expand file tree Collapse file tree 3 files changed +46
-3
lines changed Original file line number Diff line number Diff line change @@ -60,12 +60,24 @@ Commit 时间: 2025-02-12 04:38:33 +0800
6060curl -fsSL https://cjbind.zxilly.dev/install.sh | bash
6161```
6262
63+ 可以使用镜像源加速下载:
64+
65+ ``` shell
66+ curl -fsSL https://cjbind.zxilly.dev/install.sh | bash -s -- --mirror
67+ ```
68+
6369#### Windows
6470
6571``` powershell
6672irm https://cjbind.zxilly.dev/install.ps1 | iex
6773```
6874
75+ 可以使用镜像源加速下载:
76+
77+ ``` powershell
78+ irm https://cjbind.zxilly.dev/install.ps1 | iex -args "--mirror"
79+ ```
80+
6981## 源码安装
7082
7183你可以查看 ` cjbind ` 源码中包含的 ` DEVELOPMENT.md ` 文件,里面包含了如何在本地构建 ` cjbind ` 和拉取依赖的详细步骤。
Original file line number Diff line number Diff line change 11$OutputEncoding = [Console ]::OutputEncoding = [Text.UTF8Encoding ]::UTF8
22
3+ # 检查是否使用镜像
4+ $UseMirror = $false
5+ foreach ($arg in $args ) {
6+ if ($arg -eq " --mirror" -or $arg -eq " -m" ) {
7+ $UseMirror = $true
8+ break
9+ }
10+ }
11+
312Write-Host " `n === 开始安装 cjbind ===" - ForegroundColor Cyan
413
514try {
@@ -30,18 +39,25 @@ try {
3039 Write-Host " √ 目录创建成功" - ForegroundColor Green
3140 }
3241 else {
33- Write-Host " ! 目录已存在,跳过创建" - ForegroundColor Yellow
42+ Write-Host " ! 目录已存在,跳过创建" - ForegroundColor Yellow
3443 }
3544}
3645catch {
3746 Write-Host " 错误:目录创建失败 - $_ " - ForegroundColor Red
3847 exit 1
3948}
4049
41- $downloadUrl = " https://github.com/cjbind/cjbind/releases/download/$latestTag /cjbind-windows-x64.exe"
50+ if ($UseMirror ) {
51+ $downloadUrl = " https://gitcode.com/Cangjie-TPC/cjbind/releases/download/$latestTag /cjbind-windows-x64.exe"
52+ $mirrorStatus = " 是"
53+ } else {
54+ $downloadUrl = " https://github.com/cjbind/cjbind/releases/download/$latestTag /cjbind-windows-x64.exe"
55+ $mirrorStatus = " 否"
56+ }
4257$destination = " $targetDir \cjbind.exe"
4358try {
4459 Write-Host " [3/3] 正在下载程序文件..." - ForegroundColor Cyan
60+ Write-Host " 使用镜像:$mirrorStatus " - ForegroundColor Yellow
4561 Write-Host " 下载地址:$downloadUrl "
4662 Write-Host " 保存路径:$destination `n "
4763
Original file line number Diff line number Diff line change 11#! /bin/bash
22set -eo pipefail
33
4+ # 检查是否使用镜像源
5+ USE_MIRROR=false
6+ for arg in " $@ " ; do
7+ if [ " $arg " = " --mirror" ] || [ " $arg " = " -m" ]; then
8+ USE_MIRROR=true
9+ break
10+ fi
11+ done
12+
413if [ -t 1 ]; then
514 RED=$( printf ' \033[31m' )
615 GREEN=$( printf ' \033[32m' )
@@ -58,7 +67,13 @@ mkdir -p "$TARGET_DIR" || error "无法创建目录: $TARGET_DIR"
5867success " 目录已创建: ${TARGET_DIR/# $HOME / ~} "
5968
6069step 4 " 下载程序文件"
61- DOWNLOAD_URL=" https://github.com/cjbind/cjbind/releases/download/$LATEST_TAG /$FILENAME "
70+ if [ " $USE_MIRROR " = true ]; then
71+ DOWNLOAD_URL=" https://gitcode.com/Cangjie-TPC/cjbind/releases/download/$LATEST_TAG /$FILENAME "
72+ echo " 使用镜像: ${YELLOW} 是${RESET} "
73+ else
74+ DOWNLOAD_URL=" https://github.com/cjbind/cjbind/releases/download/$LATEST_TAG /$FILENAME "
75+ echo " 使用镜像: ${YELLOW} 否${RESET} "
76+ fi
6277echo " 源地址: ${CYAN}${DOWNLOAD_URL}${RESET} "
6378echo " 目标路径: ${CYAN}${TARGET_DIR/# $HOME / ~} /cjbind${RESET} "
6479
You can’t perform that action at this time.
0 commit comments