🐛 fix: 日志加颜色,更新文档中的命令格式

This commit is contained in:
HawkinC Macbook 2025-05-21 13:36:29 +08:00
parent da8bfaa008
commit fd820a40c5
2 changed files with 10 additions and 15 deletions

View File

@ -46,16 +46,15 @@ test -f "$HOME"/.config/.bin/.Runtime/SELF_MARK_AS_INSTALLED_FROM_SCRIPT && {
# 克隆,如果失败则退出并恢复原有配置 # 克隆,如果失败则退出并恢复原有配置
git clone --depth 1 --branch "$BRANCH" --single-branch https://gitea.yever.top/Hawkin/.config.git "$HOME"/.config git clone --depth 1 --branch "$BRANCH" --single-branch https://gitea.yever.top/Hawkin/.config.git "$HOME"/.config
test $? -ne 0 && { test $? -ne 0 && {
echo "git clone failed, please check your network." echo -e "\033[031mgit clone failed, please check your network.\033[0m"
# 删除克隆的目录 # 删除克隆的目录,恢复原有配置
echo "delete the unfinished clone dir: $HOME/.config" echo -e "\033[034mdelete the unfinished clone dir: $HOME/.config"
[ -d "$HOME/.config" ] && rm -rf "$HOME/.config" [ -d "$HOME/.config" ] && rm -rf "$HOME/.config"
# 恢复原有配置
if test -d /tmp/.config; then if test -d /tmp/.config; then
echo "restoring the old config to $HOME/.config" echo -e "\033[034mrestoring the old config to $HOME/.config.\033[0m"
mv /tmp/.config "$HOME/.config" mv /tmp/.config "$HOME/.config"
else else
echo "no old config found, skip restore config dir." echo -e "\033[032mno old config found, skip restore config dir..\033[0m"
fi fi
exit 1 exit 1
} }
@ -67,9 +66,8 @@ cat >"$HOME"/.config/.bin/.Runtime/SELF_MARK_AS_INSTALLED_FROM_SCRIPT <<EOF
如果你想要重新安装, 请删除此文件——下次安装时会将当前配置仓库移动到备份目录(默认为~/.local/share/Origin_Config_Backup. 如果你想要重新安装, 请删除此文件——下次安装时会将当前配置仓库移动到备份目录(默认为~/.local/share/Origin_Config_Backup.
EOF EOF
echo "git clone success, init project by script itself..."
# = 通过目标仓库的初始化脚本进行初始化 # = 通过目标仓库的初始化脚本进行初始化
if test "$INIT" = "enable"; then if test "$INIT" = "enable"; then
echo -e "\033[032mgit clone success, init project by script itself...\033[0m"
bash "$HOME"/.config/.bin/bin/Init.sh bash "$HOME"/.config/.bin/bin/Init.sh
fi fi

View File

@ -9,17 +9,14 @@
克隆 dev 分支(`-b`,默认)并进行初始化(`-i` 克隆 dev 分支(`-b`,默认)并进行初始化(`-i`
```bash ```bash
curl -sSL https://gitea.yever.top/Hawkin/setup-kit/raw/main/config-os-and-apps.sh | bash -- -ib dev curl -sSL https://gitea.yever.top/Hawkin/setup-kit/raw/main/config-os-and-apps.sh | bash -s -- -ib dev
``` ```
指定分支(`-b`)但不进行初始化: 指定分支(`-b`)但不进行初始化:
```bash ````bash
curl -sSL https://gitea.yever.top/Hawkin/setup-kit/raw/main/config-os-and-apps.sh | bash -- -b dev curl -sSL https://gitea.yever.top/Hawkin/setup-kit/raw/main/config-os-and-apps.sh | bash -s -- -b dev
```
```bash ```bash
wget -qO- https://gitea.yever.top/Hawkin/setup-kit/raw/main/config-os-and-apps.sh | bash wget -qO- https://gitea.yever.top/Hawkin/setup-kit/raw/main/config-os-and-apps.sh | bash
``` ````