diff --git a/src/framework/core.c b/src/framework/core.c index a89f1bd..cee916b 100644 --- a/src/framework/core.c +++ b/src/framework/core.c @@ -1575,7 +1575,7 @@ chsrc_ensure_dir (const char *dir) chsrc_run_as_a_service (cmd); char *msg = ENGLISH ? "Directory doesn't exist, created automatically " : "目录不存在,已自动创建 "; - chsrc_note2 (xy_2strjoin (msg, dir)); + chsrc_alert2 (xy_2strjoin (msg, dir)); } @@ -1701,7 +1701,7 @@ chsrc_backup (const char *path) if (!exist) { char *msg = ENGLISH ? "File doesn't exist, skip backup: " : "文件不存在,跳过备份: "; - chsrc_note2 (xy_2strjoin (msg, path)); + chsrc_alert2 (xy_2strjoin (msg, path)); return; } diff --git a/src/recipe/lang/Node.js/Node.js.c b/src/recipe/lang/Node.js/Node.js.c index 5291071..b3afb04 100644 --- a/src/recipe/lang/Node.js/Node.js.c +++ b/src/recipe/lang/Node.js/Node.js.c @@ -68,7 +68,7 @@ pl_nodejs_group_setsrc (char *option) "npm, pnpm, yarn. If you need to change the source independently, " "please run independently `chsrc set `" : "将同时更换3个包管理器 npm, pnpm, Yarn 的源,若需要独立换源,请独立运行 chsrc set "; - chsrc_note2 (msg); + chsrc_alert2 (msg); } bool npm_exist, yarn_exist, pnpm_exist; diff --git a/src/recipe/lang/OCaml.c b/src/recipe/lang/OCaml.c index 1c35732..2970802 100644 --- a/src/recipe/lang/OCaml.c +++ b/src/recipe/lang/OCaml.c @@ -49,8 +49,8 @@ pl_ocaml_setsrc (char *option) chsrc_run (cmd, RunOpt_Default); - chsrc_note2 ("如果是首次使用 opam ,请使用以下命令进行初始化"); - p(xy_2strjoin ("opam init default ", source.url)); + chsrc_alert2 ("如果是首次使用 opam ,请使用以下命令进行初始化"); + println (xy_2strjoin ("opam init default ", source.url)); chsrc_determine_chgtype (ChgType_SemiAuto); chsrc_conclude (&source); diff --git a/src/recipe/lang/Perl.c b/src/recipe/lang/Perl.c index cb2e69a..1fc976c 100644 --- a/src/recipe/lang/Perl.c +++ b/src/recipe/lang/Perl.c @@ -60,7 +60,7 @@ pl_perl_setsrc (char *option) "perl -MCPAN -e \"CPAN::HandleConfig->load(); CPAN::HandleConfig->edit('urllist', 'unshift', '", source.url, "'); CPAN::HandleConfig->commit()\""); chsrc_run (cmd, RunOpt_Default); - chsrc_note2 ("请使用 perl -v 以及 cpan -v,若 Perl >= v5.36 或 CPAN >= 2.29,请额外手动调用下面的命令"); + chsrc_alert2 ("请使用 perl -v 以及 cpan -v,若 Perl >= v5.36 或 CPAN >= 2.29,请额外手动调用下面的命令"); p ("perl -MCPAN -e \"CPAN::HandleConfig->load(); CPAN::HandleConfig->edit('pushy_https', 0);; CPAN::HandleConfig->commit()\""); chsrc_determine_chgtype (ChgType_SemiAuto); diff --git a/src/recipe/lang/Python/Poetry.c b/src/recipe/lang/Python/Poetry.c index 4a0b3f8..ae6236d 100644 --- a/src/recipe/lang/Python/Poetry.c +++ b/src/recipe/lang/Python/Poetry.c @@ -15,7 +15,7 @@ void pl_python_poetry_getsrc (char *option) { - chsrc_note2 ("poetry换源情况: 请查阅本项目 pyproject.toml 中 [[tool.poetry.source]]"); + chsrc_note2 ("poetry换源情况: 请查看本项目 pyproject.toml 中 [[tool.poetry.source]]"); } @@ -34,7 +34,7 @@ pl_python_poetry_setsrc (char *option) char *cmd = NULL; if (!chsrc_in_local_mode()) - chsrc_note2 ("Poertry 仅支持项目级换源"); + chsrc_alert2 ("Poetry 仅支持项目级换源"); cmd = xy_2strjoin ("poetry source add my_mirror ", source.url); chsrc_run (cmd, RunOpt_No_Last_New_Line); diff --git a/src/recipe/lang/Python/Python.c b/src/recipe/lang/Python/Python.c index 69b69ef..2507674 100644 --- a/src/recipe/lang/Python/Python.c +++ b/src/recipe/lang/Python/Python.c @@ -48,7 +48,7 @@ pl_python_group_setsrc (char *option) "pip, Poetry, PDM. If you need to change the source independently, " "please run independently `chsrc set `" : "将同时更换4个包管理器 pip, Poetry, PDM, uv 的源,若需要独立换源,请独立运行 chsrc set "; - chsrc_note2 (msg); + chsrc_alert2 (msg); } bool pdm_exist = false, diff --git a/src/recipe/lang/Rust/rustup.c b/src/recipe/lang/Rust/rustup.c index 563f74f..417728b 100644 --- a/src/recipe/lang/Rust/rustup.c +++ b/src/recipe/lang/Rust/rustup.c @@ -96,7 +96,7 @@ pl_rust_rustup_setsrc (char *option) chsrc_determine_chgtype (ChgType_Auto); chsrc_conclude (&source); - chsrc_note2 ("请重启终端使rustup环境变量生效"); + chsrc_alert2 ("请重启终端使rustup环境变量生效"); } diff --git a/src/recipe/os/APT/Debian.c b/src/recipe/os/APT/Debian.c index 0d49276..98f96a3 100644 --- a/src/recipe/os/APT/Debian.c +++ b/src/recipe/os/APT/Debian.c @@ -140,7 +140,7 @@ os_debian_setsrc (char *option) return; } - chsrc_note2 ("将基于旧格式(非DEB822)换源"); + chsrc_alert2 ("将基于旧格式(非DEB822)换源"); /* Docker环境下,Debian镜像可能不存在该文件 */ bool sourcelist_exist = ensure_debian_or_ubuntu_old_sourcelist (OS_Is_Debian_Literally); @@ -167,7 +167,7 @@ os_debian_setsrc (char *option) chsrc_yield_source_and_confirm (os_debian); - chsrc_note2 ("如果遇到无法拉取 HTTPS 源的情况,请手动运行:"); + chsrc_alert2 ("如果遇到无法拉取 HTTPS 源的情况,请手动运行:"); say ("apt install apt-transport-https ca-certificates"); /* 不存在的时候,用的是我们生成的用来填充占位的无效文件,不要备份 */ diff --git a/src/recipe/os/APT/Ubuntu.c b/src/recipe/os/APT/Ubuntu.c index d0fd05b..600cd01 100644 --- a/src/recipe/os/APT/Ubuntu.c +++ b/src/recipe/os/APT/Ubuntu.c @@ -131,7 +131,7 @@ os_ubuntu_setsrc (char *option) return; } - chsrc_note2 ("将基于旧格式(非DEB822)换源"); + chsrc_alert2 ("将基于旧格式(非DEB822)换源"); bool sourcelist_exist = ensure_debian_or_ubuntu_old_sourcelist (OS_Is_Ubuntu); diff --git a/src/recipe/os/BSD/FreeBSD.c b/src/recipe/os/BSD/FreeBSD.c index 9d30de5..722a6ca 100644 --- a/src/recipe/os/BSD/FreeBSD.c +++ b/src/recipe/os/BSD/FreeBSD.c @@ -60,7 +60,7 @@ os_freebsd_setsrc (char *option) chsrc_note2 ( xy_strjoin (3, "若要使用季度分支,请在", conf ,"中将latest改为quarterly")); - chsrc_note2 ("若要使用HTTPS源,请先安装securtiy/ca_root_ns,并将'http'改成'https',最后使用'pkg update -f'刷新缓存即可\n"); + chsrc_alert2 ("若要使用HTTPS源,请先安装securtiy/ca_root_ns,并将'http'改成'https',最后使用'pkg update -f'刷新缓存即可\n"); br(); chsrc_log2 ("2. 修改 freebsd-ports 源"); @@ -77,7 +77,7 @@ os_freebsd_setsrc (char *option) char *git_cmd = xy_strjoin (3, "git clone --depth 1 https://", source.url, "/freebsd-ports/ports.git /usr/ports"); chsrc_run (git_cmd, RunOpt_Default); source = os_freebsd_sources[index]; // 恢复至选中的源 - chsrc_note2 ("下次更新请使用 git -C /usr/ports pull 而非使用 gitup"); + chsrc_alert2 ("下次更新请使用 git -C /usr/ports pull 而非使用 gitup"); } else { @@ -114,7 +114,7 @@ os_freebsd_setsrc (char *option) // HELP: 暂时没有源提供 - chsrc_note2 ("4. 抱歉,目前境内无 freebsd-update 源,若存在请报告issue,谢谢"); + chsrc_alert2 ("4. 抱歉,目前境内无 freebsd-update 源,若存在请报告issue,谢谢"); /* chsrc_log2 ("3. 修改 freebsd-update 源"); diff --git a/src/recipe/os/YUM/Fedora-Linux.c b/src/recipe/os/YUM/Fedora-Linux.c index c6ee6da..b1518b7 100644 --- a/src/recipe/os/YUM/Fedora-Linux.c +++ b/src/recipe/os/YUM/Fedora-Linux.c @@ -44,7 +44,7 @@ os_fedora_setsrc (char *option) chsrc_yield_source_and_confirm (os_fedora); - chsrc_note2 ("Fedora 38 及以下版本暂不支持"); + chsrc_alert2 ("Fedora 38 及以下版本暂不支持"); chsrc_backup ("/etc/yum.repos.d/fedora.repo"); chsrc_backup ("/etc/yum.repos.d/fedora-updates.repo"); @@ -69,7 +69,7 @@ os_fedora_setsrc (char *option) "/etc/yum.repos.d/fedora-updates.repo"); chsrc_run (cmd, RunOpt_Default); - chsrc_note2 ("已更换baseurl, 但Fedora默认会优先使用metalink来匹配最快的源, 若在获取metadata时速度较慢可自行将其注释:"); + chsrc_alert2 ("已更换baseurl, 但Fedora默认会优先使用metalink来匹配最快的源, 若在获取metadata时速度较慢可自行将其注释:"); chsrc_log2 ("(1) /etc/yum.repos.d/fedora.repo"); chsrc_log2 ("(2) /etc/yum.repos.d/fedora-updates.repo"); diff --git a/src/recipe/ware/Anaconda/Anaconda.c b/src/recipe/ware/Anaconda/Anaconda.c index 2349ee1..48bbc17 100644 --- a/src/recipe/ware/Anaconda/Anaconda.c +++ b/src/recipe/ware/Anaconda/Anaconda.c @@ -56,7 +56,7 @@ wr_anaconda_setsrc (char *option) { if (xy_file_exist (configfile)) { - chsrc_note2 ("配置文件不存在,将使用 conda 命令创建"); + chsrc_alert2 ("配置文件不存在,将使用 conda 命令创建"); bool conda_exist = chsrc_check_program ("conda"); if (!conda_exist) { diff --git a/src/recipe/ware/Docker-Hub/Docker-Hub.c b/src/recipe/ware/Docker-Hub/Docker-Hub.c index 949aa3a..9011683 100644 --- a/src/recipe/ware/Docker-Hub/Docker-Hub.c +++ b/src/recipe/ware/Docker-Hub/Docker-Hub.c @@ -89,7 +89,7 @@ wr_dockerhub_setsrc (char *option) char *result = xy_run (cmd, 0); if (result && !xy_streql (result, "null")) { - chsrc_note2 ("已存在源,无需重复添加"); + chsrc_alert2 ("已存在源,无需重复添加"); } else { @@ -101,7 +101,7 @@ wr_dockerhub_setsrc (char *option) } else { - chsrc_note2 ("未找到 jq 命令, 将使用 sed 换源"); + chsrc_alert2 ("未找到 jq 命令, 将使用 sed 换源"); char *cmd = xy_str_gsub (RAWSTR_wr_dockerhub_sed_command, "@1@", source.url); cmd = xy_str_gsub (cmd, "@2@", WR_DockerHub_ConfigFile); chsrc_run (cmd, RunOpt_Default); @@ -110,7 +110,7 @@ wr_dockerhub_setsrc (char *option) else { /* 不存在 /etc/docker/daemon.json 时可以直接写入文件 */ - chsrc_note2 ("未找到Docker配置文件, 将自动创建"); + chsrc_alert2 ("未找到Docker配置文件, 将自动创建"); chsrc_ensure_dir ("/etc/docker"); chsrc_run ( xy_2strjoin ("touch ", WR_DockerHub_ConfigFile), RunOpt_Default); @@ -120,12 +120,12 @@ wr_dockerhub_setsrc (char *option) if (xy_on_linux) { /* 由于 systemctl restart docker 会导致所有容器停止,所以不自动重启 */ - chsrc_note2 ("请自行运行: sudo systemctl restart docker"); - chsrc_note2 ("该命令会重启所有容器, 请在合适的时机执行"); + chsrc_alert2 ("请自行运行: sudo systemctl restart docker"); + chsrc_alert2 ("该命令会重启所有容器, 请在合适的时机执行"); } else { - chsrc_note2 ("然后请手动重启 docker 服务"); + chsrc_alert2 ("然后请手动重启 docker 服务"); } } else diff --git a/src/recipe/ware/Flathub.c b/src/recipe/ware/Flathub.c index 1d32327..c84284a 100644 --- a/src/recipe/ware/Flathub.c +++ b/src/recipe/ware/Flathub.c @@ -66,7 +66,7 @@ wr_flathub_setsrc (char *option) { chsrc_yield_source_and_confirm (wr_flathub); - chsrc_note2 ("若出现问题,可先调用以下命令:"); + chsrc_alert2 ("若出现问题,可先调用以下命令:"); char *note = xy_strjoin (3, "wget ", source.url, "/flathub.gpg\n" "flatpak remote-modify --gpg-import=flathub.gpg flathub" diff --git a/src/recipe/ware/Homebrew/Homebrew.c b/src/recipe/ware/Homebrew/Homebrew.c index 0c89a79..0b7dfc2 100644 --- a/src/recipe/ware/Homebrew/Homebrew.c +++ b/src/recipe/ware/Homebrew/Homebrew.c @@ -75,7 +75,7 @@ wr_homebrew_setsrc (char *option) chsrc_determine_chgtype (ChgType_Auto); chsrc_conclude (&source); - chsrc_note2 ("请重启终端使Homebrew环境变量生效"); + chsrc_alert2 ("请重启终端使Homebrew环境变量生效"); } diff --git a/test/fw.c b/test/fw.c index 03e169b..efad9af 100644 --- a/test/fw.c +++ b/test/fw.c @@ -4,7 +4,7 @@ * File Authors : Aoran Zeng * Contributors : Nil Null * Created On : <2024-12-14> - * Last Modified : <2025-07-14> + * Last Modified : <2025-07-21> * * 该文件最好启用 DEBUG mode 编译 * ------------------------------------------------------------*/ @@ -35,6 +35,7 @@ main (int argc, char const *argv[]) chsrc_succ2 ("chsrc_succ2"); chsrc_log2 ("chsrc_log2"); chsrc_note2 ("chsrc_note2"); + chsrc_alert2 ("chsrc_alert2"); chsrc_warn2 ("chsrc_warn2"); chsrc_error2 ("chsrc_error2"); chsrc_debug2 ("fw", "chsrc_debug2");