2023-12-12 16:04:04 +08:00
|
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
|
|
# 加速下载 GitHub 文件
|
|
|
|
|
|
|
|
|
|
# 相关参数
|
|
|
|
|
## 版本号
|
2023-12-28 15:26:16 +08:00
|
|
|
|
VERSION=0.3.0
|
2023-12-12 16:04:04 +08:00
|
|
|
|
|
|
|
|
|
# 相关方法
|
|
|
|
|
## 帮助
|
|
|
|
|
help () {
|
|
|
|
|
echo 'Usage: ghd GitHub文件URL(支持 github.com 和 raw.githubusercontent.com )'
|
|
|
|
|
echo '示例:'
|
|
|
|
|
echo ' ghd https://github.com/docker/compose/releases/download/v2.19.1/docker-compose-linux-x86_64'
|
|
|
|
|
}
|
|
|
|
|
## 版本号
|
|
|
|
|
version () {
|
2024-01-08 08:48:13 +08:00
|
|
|
|
echo 'ghd '$VERSION
|
2023-12-12 16:04:04 +08:00
|
|
|
|
}
|
|
|
|
|
## 下载文件
|
|
|
|
|
download () {
|
|
|
|
|
echo '------------------------------ 正在通过 GitHub Proxy (https://ghproxy.com) 下载 GitHub 文件,请稍后... ------------------------------'
|
2023-12-28 15:26:16 +08:00
|
|
|
|
# curl -O https://ghproxy.com/$1
|
|
|
|
|
# curl -O https://mirror.ghproxy.com/$1
|
2023-12-28 15:52:26 +08:00
|
|
|
|
wget https://github.moeyy.xyz/$1
|
2023-12-12 16:04:04 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# 执行方法
|
|
|
|
|
case $1 in
|
|
|
|
|
help)
|
|
|
|
|
help
|
|
|
|
|
;;
|
|
|
|
|
version)
|
|
|
|
|
version
|
|
|
|
|
;;
|
|
|
|
|
*)
|
2023-12-28 15:52:26 +08:00
|
|
|
|
# download
|
|
|
|
|
wget https://github.moeyy.xyz/$1
|
2023-12-12 16:04:04 +08:00
|
|
|
|
;;
|
|
|
|
|
esac
|