shell_tools/ghd
2024-01-08 08:48:13 +08:00

41 lines
835 B
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/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