41 lines
835 B
Bash
Executable File
41 lines
835 B
Bash
Executable File
#!/bin/bash
|
||
|
||
# 加速下载 GitHub 文件
|
||
|
||
# 相关参数
|
||
## 版本号
|
||
VERSION=0.3.0
|
||
|
||
# 相关方法
|
||
## 帮助
|
||
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 () {
|
||
echo 'ghd '$VERSION
|
||
}
|
||
## 下载文件
|
||
download () {
|
||
echo '------------------------------ 正在通过 GitHub Proxy (https://ghproxy.com) 下载 GitHub 文件,请稍后... ------------------------------'
|
||
# curl -O https://ghproxy.com/$1
|
||
# curl -O https://mirror.ghproxy.com/$1
|
||
wget https://github.moeyy.xyz/$1
|
||
}
|
||
|
||
# 执行方法
|
||
case $1 in
|
||
help)
|
||
help
|
||
;;
|
||
version)
|
||
version
|
||
;;
|
||
*)
|
||
# download
|
||
wget https://github.moeyy.xyz/$1
|
||
;;
|
||
esac
|