Use chsrc_determine_chgtype()

This commit is contained in:
Aoran Zeng 2025-03-06 12:36:16 +08:00
parent 7226eecf3d
commit 2d75a48c19
No known key found for this signature in database
GPG Key ID: 8F8BA8488E10ED98
67 changed files with 113 additions and 85 deletions

View File

@ -9,7 +9,7 @@
* | Yangmoooo <yangmoooo@outlook.com>
* |
* Created On : <2023-08-29>
* Last Modified : <2024-12-14>
* Last Modified : <2025-03-06>
*
* chsrc framework
* ------------------------------------------------------------*/
@ -783,6 +783,11 @@ source_has_empty_url (Source_t *source)
return source->url == NULL;
}
bool
is_reset_mode ()
{
return ProgMode_CMD_Reset;
}
/**
@ -868,6 +873,13 @@ confirm_source (Source_t *source)
#define chsrc_yield_source_and_confirm(for_what) chsrc_yield_source(for_what);chsrc_confirm_source
void
chsrc_determine_chgtype (enum ChgType_t type)
{
ProgMode_ChgType = is_reset_mode() ? ChgType_Reset : type;
}
#define MSG_EN_PUBLIC_URL "If the URL you specify is a public service, you are invited to contribute: chsrc issue"
#define MSG_CN_PUBLIC_URL "若您指定的URL为公有服务,邀您参与贡献: chsrc issue"
@ -895,7 +907,7 @@ confirm_source (Source_t *source)
/**
* @param source NULL
*
* @param[g] ProgMode_ChgType
* @param [g]ProgMode_ChgType
*/
void
chsrc_conclude (Source_t *source)

View File

@ -27,7 +27,8 @@ pl_clojure_setsrc (char *option)
chsrc_note2 ("抱歉,Clojure换源较复杂,您可手动查阅并换源:");
p(source.url);
ProgMode_ChgType = ChgType_Manual;
chsrc_determine_chgtype (ChgType_Manual);
chsrc_conclude (&source);
}

View File

@ -84,7 +84,7 @@ pl_dart_flutter_setsrc (char *option)
}
}
ProgMode_ChgType = ProgMode_CMD_Reset ? ChgType_Reset : ChgType_Auto;
chsrc_determine_chgtype (ChgType_Auto);
chsrc_conclude (&source);
}

View File

@ -80,7 +80,7 @@ pl_dart_setsrc (char *option)
}
}
ProgMode_ChgType = ProgMode_CMD_Reset ? ChgType_Reset : ChgType_Auto;
chsrc_determine_chgtype (ChgType_Auto);
chsrc_conclude (&source);
}

View File

@ -83,7 +83,8 @@ pl_go_setsrc (char *option)
cmd = xy_strjoin (3, "go env -w GOPROXY=", source.url, ",direct");
chsrc_run (cmd, RunOpt_Default);
ProgMode_ChgType = ProgMode_CMD_Reset ? ChgType_Reset : ChgType_Auto;
chsrc_determine_chgtype (ChgType_Auto);
chsrc_conclude (&source);
}

View File

@ -62,7 +62,8 @@ pl_haskell_setsrc (char *option)
chsrc_note2 (xy_strjoin (3, "请向 ", config, " 中手动添加:"));
p(file);
ProgMode_ChgType = ChgType_Manual;
chsrc_determine_chgtype (ChgType_Manual);
chsrc_conclude (&source);
}

View File

@ -101,7 +101,8 @@ pl_java_setsrc (char *option)
chsrc_note2 ("请在您的 build.gradle 中添加:");
p(file);
}
ProgMode_ChgType = ChgType_Manual;
chsrc_determine_chgtype (ChgType_Manual);
chsrc_conclude (&source);
}

View File

@ -49,7 +49,7 @@ pl_julia_setsrc (char *option)
chsrc_append_to_file (w, PL_Julia_Config);
ProgMode_ChgType = ChgType_Untested;
chsrc_determine_chgtype (ChgType_Untested);
chsrc_conclude (&source);
}

View File

@ -34,7 +34,7 @@ pl_lua_getsrc (char *option)
}
/**
* Lua https://luarocks.cn/
* @consult https://luarocks.cn/
*/
void
pl_lua_setsrc (char *option)
@ -54,7 +54,7 @@ pl_lua_setsrc (char *option)
chsrc_note2 ("请手动修改 ~/.luarocks/upload_config.lua 文件 (用于上传):");
p(upload_config);
ProgMode_ChgType = ChgType_Manual;
chsrc_determine_chgtype (ChgType_Manual);
chsrc_conclude (&source);
}

View File

@ -43,7 +43,8 @@ pl_nodejs_bun_setsrc (char *option)
}
p(file);
ProgMode_ChgType = ProgMode_CMD_Reset ? ChgType_Reset : ChgType_Auto;
chsrc_determine_chgtype (ChgType_Auto);
chsrc_conclude (&source);
}

View File

@ -94,7 +94,7 @@ pl_nodejs_setsrc (char *option)
pl_nodejs_pnpm_setsrc (option);
}
ProgMode_ChgType = ProgMode_CMD_Reset ? ChgType_Reset : ChgType_Auto;
chsrc_determine_chgtype (ChgType_Auto);
chsrc_conclude (&source);
}

View File

@ -73,7 +73,7 @@ pl_nodejs_yarn_setsrc (char *option)
if (ProgMode_Target_Group!=true)
{
ProgMode_ChgType = ProgMode_CMD_Reset ? ChgType_Reset : ChgType_Auto;
chsrc_determine_chgtype (ChgType_Auto);
chsrc_conclude (&source);
}
}

View File

@ -42,7 +42,7 @@ pl_nodejs_npm_setsrc (char *option)
if (ProgMode_Target_Group!=true)
{
ProgMode_ChgType = ProgMode_CMD_Reset ? ChgType_Reset : ChgType_Auto;
chsrc_determine_chgtype (ChgType_Auto);
chsrc_conclude (&source);
}
}

View File

@ -42,7 +42,7 @@ pl_nodejs_nvm_setsrc (char *option)
if (xy_file_exist (zshrc))
chsrc_append_to_file (w, zshrc);
ProgMode_ChgType = ProgMode_CMD_Reset ? ChgType_Reset : ChgType_Auto;
chsrc_determine_chgtype (ChgType_Auto);
chsrc_conclude (&source);
}

View File

@ -43,7 +43,7 @@ pl_nodejs_pnpm_setsrc (char *option)
if (ProgMode_Target_Group!=true)
{
ProgMode_ChgType = ProgMode_CMD_Reset ? ChgType_Reset : ChgType_Auto;
chsrc_determine_chgtype (ChgType_Auto);
chsrc_conclude (&source);
}
}

View File

@ -24,18 +24,20 @@ pl_ocaml_check_cmd ()
chsrc_ensure_program ("opam");
}
void
pl_ocaml_getsrc(char *option)
pl_ocaml_getsrc (char *option)
{
pl_ocaml_check_cmd ();
chsrc_run ("opam repo get-url default", RunOpt_Default);
}
/**
* : https://mirrors.sjtug.sjtu.edu.cn/docs/git/opam-repository.git
* @consult https://mirrors.sjtug.sjtu.edu.cn/docs/git/opam-repository.git
*/
void
pl_ocaml_setsrc(char *option)
pl_ocaml_setsrc (char *option)
{
pl_ocaml_check_cmd ();
@ -50,7 +52,7 @@ pl_ocaml_setsrc(char *option)
chsrc_note2 ("如果是首次使用 opam ,请使用以下命令进行初始化");
p(xy_2strjoin ("opam init default ", source.url));
ProgMode_ChgType = ChgType_SemiAuto;
chsrc_determine_chgtype (ChgType_SemiAuto);
chsrc_conclude (&source);
}

View File

@ -57,7 +57,7 @@ pl_php_setsrc (char *option)
char *cmd = xy_strjoin (4, "composer config", where, "repo.packagist composer ", source.url);
chsrc_run (cmd, RunOpt_Default);
ProgMode_ChgType = ChgType_Auto;
chsrc_determine_chgtype (ChgType_Auto);
chsrc_conclude (&source);
}

View File

@ -63,7 +63,7 @@ pl_perl_setsrc (char *option)
chsrc_note2 ("请您使用 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()\"");
ProgMode_ChgType = ChgType_SemiAuto;
chsrc_determine_chgtype (ChgType_SemiAuto);
chsrc_conclude (&source);
}

View File

@ -44,7 +44,7 @@ pl_python_pdm_setsrc (char *option)
if (ProgMode_Target_Group!=true)
{
ProgMode_ChgType = ProgMode_CMD_Reset ? ChgType_Reset : ChgType_Auto;
chsrc_determine_chgtype (ChgType_Auto);
chsrc_conclude (&source);
}
}

View File

@ -42,7 +42,7 @@ pl_python_poetry_setsrc (char *option)
if (ProgMode_Target_Group!=true)
{
ProgMode_ChgType = ProgMode_CMD_Reset ? ChgType_Reset : ChgType_Auto;
chsrc_determine_chgtype (ChgType_Auto);
chsrc_conclude (&source);
}
}

View File

@ -81,7 +81,7 @@ pl_python_setsrc (char *option)
pl_python_uv_setsrc (option);
}
ProgMode_ChgType = ProgMode_CMD_Reset ? ChgType_Reset : ChgType_Auto;
chsrc_determine_chgtype (ChgType_Auto);
chsrc_conclude (&source);
}

View File

@ -49,7 +49,7 @@ pl_python_rye_setsrc (char *option)
chsrc_note2 (xy_strjoin (3, "请在您的 Rye 配置文件 ", rye_config, " 中添加:"));
puts (file);
ProgMode_ChgType = ChgType_Manual;
chsrc_determine_chgtype (ChgType_Manual);
chsrc_conclude (&source);
}

View File

@ -54,7 +54,7 @@ pl_python_pip_setsrc (char *option)
if (ProgMode_Target_Group!=true)
{
ProgMode_ChgType = ProgMode_CMD_Reset ? ChgType_Reset : ChgType_Auto;
chsrc_determine_chgtype (ChgType_Auto);
chsrc_conclude (&source);
}
}

View File

@ -67,28 +67,28 @@ void
pl_python_uv_setsrc (char *option)
{
chsrc_ensure_program("uv");
Source_t source;
chsrc_yield_for_the_source (pl_python);
char *uv_config = pl_python_find_uv_config (true);
chsrc_backup (uv_config);
const char *source_content = xy_strjoin (5,
"[[index]]\n",
"url = \"", source.url, "\"\n",
"default = true\n");
// sed -i '/^\[\[index\]\]$/,/^default = true$/{s|^url = ".*"$|url = " source.url "|}' uv_config
// 将 [[index]] 到 default = true 之间的 url = ".*" 替换为 url = "source.url"
char *update_source_cmd = xy_strjoin (5, "sed -i ",
"'/^\\[\\[index\\]\\]$/,/^default = true$/{s|^url = \".*\"$|url = \"",
source.url,
source.url,
"\"|}' ",
uv_config);
char *append_source_cmd = xy_strjoin (4, "echo -e '", source_content, "' >> ", uv_config);
// grep -q '^[[index]]$' uv_config && update_source_cmd || append_source_cmd
// 如果 uv_config 中存在 [[index]] 则更新, 否则追加到文件末尾
// 文件不存在也是追加到新文件末尾
@ -98,8 +98,11 @@ pl_python_uv_setsrc (char *option)
update_source_cmd,
" || ",
append_source_cmd);
chsrc_run (cmd, RunOpt_Default);
chsrc_determine_chgtype (ChgType_Auto);
chsrc_conclude (&source);
}

View File

@ -71,7 +71,7 @@ pl_r_setsrc (char *option)
chsrc_append_to_file (w, config);
ProgMode_ChgType = ChgType_Auto;
chsrc_determine_chgtype (ChgType_Auto);
chsrc_conclude (&source);
}

View File

@ -91,7 +91,7 @@ pl_ruby_setsrc (char *option)
cmd = xy_strjoin (4, "bundle config", where, "'mirror.https://rubygems.org' ", source.url);
chsrc_run (cmd, RunOpt_No_Last_New_Line);
ProgMode_ChgType = ProgMode_CMD_Reset ? ChgType_Reset : ChgType_Auto;
chsrc_determine_chgtype (ChgType_Auto);
chsrc_conclude (&source);
}

View File

@ -63,7 +63,8 @@ pl_rust_cargo_setsrc (char *option)
chsrc_note2 (xy_strjoin (3, "请您手动写入以下内容到 ", xy_normalize_path ("~/.cargo/config.toml"), " 文件中:"));
p(file);
ProgMode_ChgType = ProgMode_CMD_Reset ? ChgType_Reset : ChgType_Auto;
chsrc_determine_chgtype (ChgType_Auto);
chsrc_conclude (&source);
}

View File

@ -84,7 +84,7 @@ pl_rust_rustup_setsrc (char *option)
chsrc_append_to_file (w, fishrc);
}
ProgMode_ChgType = ProgMode_CMD_Reset ? ChgType_Reset : ChgType_Auto;
chsrc_determine_chgtype (ChgType_Auto);
chsrc_conclude (&source);
chsrc_note2 ("请您重启终端使rustup环境变量生效");
}

View File

@ -58,7 +58,7 @@ os_armbian_setsrc (char *option)
chsrc_run (cmd, RunOpt_Default);
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
ProgMode_ChgType = ChgType_Auto;
chsrc_determine_chgtype (ChgType_Auto);
chsrc_conclude (&source);
}

View File

@ -74,7 +74,7 @@ os_debian_setsrc_for_deb822 (char *option)
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
ProgMode_ChgType = ChgType_Auto;
chsrc_determine_chgtype (ChgType_Auto);
chsrc_conclude (&source);
}
@ -115,7 +115,7 @@ os_debian_setsrc (char *option)
chsrc_run (cmd, RunOpt_Default);
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
ProgMode_ChgType = ProgMode_CMD_Reset ? ChgType_Reset : ChgType_Auto;
chsrc_determine_chgtype (ChgType_Auto);
chsrc_conclude (&source);
}

View File

@ -60,7 +60,7 @@ os_kali_setsrc (char *option)
chsrc_run (cmd, RunOpt_Default);
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
ProgMode_ChgType = ChgType_Untested;
chsrc_determine_chgtype (ChgType_Untested);
chsrc_conclude (&source);
}

View File

@ -34,7 +34,7 @@ os_linuxlite_getsrc (char *option)
}
/**
* : https://help.mirrors.cernet.edu.cn/linuxliteos/
* @consult https://help.mirrors.cernet.edu.cn/linuxliteos/
*/
void
os_linuxlite_setsrc (char *option)
@ -49,7 +49,7 @@ os_linuxlite_setsrc (char *option)
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
ProgMode_ChgType = ChgType_Auto;
chsrc_determine_chgtype (ChgType_Auto);
chsrc_conclude (&source);
}

View File

@ -39,7 +39,7 @@ os_linuxmint_getsrc (char *option)
}
/**
* : https://help.mirrors.cernet.edu.cn/linuxmint/
* @consult https://help.mirrors.cernet.edu.cn/linuxmint/
*/
void
os_linuxmint_setsrc (char *option)
@ -55,13 +55,13 @@ os_linuxmint_setsrc (char *option)
char *version_codename = xy_run ("sed -nr 's/^VERSION_CODENAME=([^\"]+)/\1/p' " ETC_OS_RELEASE, 0);
// sed -i '/<version_codename>/ s|http[^ ]*|<source.url>|g' OS_LinuxMint_SourceList
char* cmd = xy_strjoin (5, "sed -i '/",
version_codename, "/ s|http[^ ]*|",
version_codename, "/ s|http[^ ]*|",
source.url, "|g' " OS_LinuxMint_SourceList);
chsrc_run (cmd, RunOpt_Default);
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
ProgMode_ChgType = ChgType_Auto;
chsrc_determine_chgtype (ChgType_Auto);
chsrc_conclude (&source);
chsrc_warn2 ("完成后请不要再使用 mintsources(自带的图形化软件源设置工具)进行任何操作,因为在操作后,无论是否有按“确定”,mintsources 均会覆写我们刚才换源的内容");
chsrc_warn2 ("已自动更换mint主要源, 但mint也使用基于debian或ubuntu的基础源, 可参考对应的debian或ubuntu换源方法进行手动换源");

View File

@ -56,7 +56,7 @@ os_ros_setsrc (char *option)
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
ProgMode_ChgType = ChgType_Untested;
chsrc_determine_chgtype (ChgType_Untested);
chsrc_conclude (&source);
}

View File

@ -24,12 +24,14 @@ static Source_t os_raspberrypi_sources[] =
};
def_sources_n(os_raspberrypi);
void
os_raspberrypi_getsrc (char *option)
{
chsrc_view_file (OS_RaspberryPi_SourceList);
}
void
os_raspberrypi_setsrc (char *option)
{
@ -45,7 +47,7 @@ os_raspberrypi_setsrc (char *option)
chsrc_run (cmd, RunOpt_Default);
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
ProgMode_ChgType = ChgType_Untested;
chsrc_determine_chgtype (ChgType_Untested);
chsrc_conclude (&source);
}

View File

@ -61,7 +61,7 @@ os_termux_setsrc (char *option)
chsrc_run ("apt update", RunOpt_Default);
chsrc_run ("apt upgrade", RunOpt_Default);
ProgMode_ChgType = ChgType_Auto;
chsrc_determine_chgtype (ChgType_Auto);
chsrc_conclude (&source);
}

View File

@ -48,7 +48,7 @@ os_trisquel_setsrc (char *option)
chsrc_run (cmd, RunOpt_Default);
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
ProgMode_ChgType = ChgType_Untested;
chsrc_determine_chgtype (ChgType_Untested);
chsrc_conclude (&source);
}

View File

@ -83,7 +83,7 @@ os_ubuntu_setsrc_for_deb822 (char *option)
chsrc_run (cmd, RunOpt_Default);
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
ProgMode_ChgType = ChgType_Auto;
chsrc_determine_chgtype (ChgType_Auto);
chsrc_conclude (&source);
}
@ -128,7 +128,7 @@ os_ubuntu_setsrc (char *option)
chsrc_run (cmd, RunOpt_Default);
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
ProgMode_ChgType = ChgType_Auto;
chsrc_determine_chgtype (ChgType_Auto);
chsrc_conclude (&source);
}

View File

@ -52,7 +52,7 @@ os_deepin_setsrc (char *option)
chsrc_run (cmd, RunOpt_Default);
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
ProgMode_ChgType = ChgType_Untested;
chsrc_determine_chgtype (ChgType_Untested);
chsrc_conclude (&source);
}

View File

@ -40,7 +40,7 @@ os_openkylin_setsrc (char *option)
chsrc_run (cmd, RunOpt_Default);
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
ProgMode_ChgType = ChgType_Untested;
chsrc_determine_chgtype (ChgType_Untested);
chsrc_conclude (&source);
}

View File

@ -57,7 +57,7 @@ os_alpine_setsrc (char *option)
chsrc_run ("apk update", RunOpt_No_Last_New_Line);
ProgMode_ChgType = ChgType_Untested;
chsrc_determine_chgtype (ChgType_Untested);
chsrc_conclude (&source);
}

View File

@ -128,7 +128,7 @@ os_freebsd_setsrc (char *option)
chsrc_overwrite_file (update, "/etc/freebsd-update.conf");
*/
ProgMode_ChgType = ChgType_SemiAuto;
chsrc_determine_chgtype (ChgType_SemiAuto);
chsrc_conclude (&source);
}

View File

@ -58,7 +58,7 @@ os_netbsd_setsrc (char *option)
char *url = xy_strjoin (5, source.url, arch, "/", version, "/All");
chsrc_overwrite_file (url, "/usr/pkg/etc/pkgin/repositories.conf");
ProgMode_ChgType = ChgType_Untested;
chsrc_determine_chgtype (ChgType_Untested);
chsrc_conclude (&source);
}

View File

@ -47,7 +47,7 @@ os_openbsd_setsrc (char *option)
chsrc_backup ("/etc/installurl");
chsrc_overwrite_file (source.url, "/etc/installurl");
ProgMode_ChgType = ChgType_Untested;
chsrc_determine_chgtype (ChgType_Untested);
chsrc_conclude (&source);
}

View File

@ -46,7 +46,7 @@ os_gentoo_setsrc (char *option)
chsrc_append_to_file (w, "/etc/portage/make.conf");
ProgMode_ChgType = ChgType_Untested;
chsrc_determine_chgtype (ChgType_Untested);
chsrc_conclude (&source);
}

View File

@ -62,7 +62,7 @@ os_openwrt_setsrc (char *option)
chsrc_run (cmd, RunOpt_No_Last_New_Line);
chsrc_run ("opkg update", RunOpt_No_Last_New_Line);
ProgMode_ChgType = ProgMode_CMD_Reset ? ChgType_Reset : ChgType_Auto;
chsrc_determine_chgtype (ChgType_Auto);
chsrc_conclude (&source);
}

View File

@ -33,7 +33,7 @@ os_solus_setsrc (char *option)
char *cmd = xy_2strjoin ("eopkg add-repo Solus ", source.url);
chsrc_run (cmd, RunOpt_Default);
ProgMode_ChgType = ChgType_Auto;
chsrc_determine_chgtype (ChgType_Auto);
chsrc_conclude (&source);
}

View File

@ -59,7 +59,8 @@ os_voidlinux_setsrc (char *option)
chsrc_note2 ("若报错可尝试使用以下命令:");
p(cmd);
ProgMode_ChgType = ChgType_Untested;
chsrc_determine_chgtype (ChgType_Untested);
chsrc_conclude (&source);
}

View File

@ -44,7 +44,7 @@ os_almalinux_setsrc (char *option)
chsrc_run (cmd, RunOpt_Default);
chsrc_run ("dnf makecache", RunOpt_No_Last_New_Line);
ProgMode_ChgType = ChgType_Auto;
chsrc_determine_chgtype (ChgType_Auto);
chsrc_conclude (&source);
}

View File

@ -37,7 +37,7 @@ os_anolis_setsrc (char *option)
chsrc_run ("dnf makecache", RunOpt_Default);
chsrc_run ("dnf update", RunOpt_No_Last_New_Line);
ProgMode_ChgType = ChgType_Untested;
chsrc_determine_chgtype (ChgType_Untested);
chsrc_conclude (&source);
}

View File

@ -72,7 +72,7 @@ os_fedora_setsrc (char *option)
chsrc_run ("dnf makecache", RunOpt_No_Last_New_Line);
ProgMode_ChgType = ProgMode_CMD_Reset ? ChgType_Reset : ChgType_Auto;
chsrc_determine_chgtype (ChgType_Auto);
chsrc_conclude (&source);
}

View File

@ -67,7 +67,7 @@ os_rockylinux_setsrc (char *option)
chsrc_run (cmd, RunOpt_Default);
chsrc_run ("dnf makecache", RunOpt_No_Last_New_Line);
ProgMode_ChgType = ChgType_Auto;
chsrc_determine_chgtype (ChgType_Auto);
chsrc_conclude (&source);
}

View File

@ -70,7 +70,7 @@ os_openeuler_setsrc (char *option)
chsrc_run ("dnf makecache", RunOpt_No_Last_New_Line);
ProgMode_ChgType = ProgMode_CMD_Reset ? ChgType_Reset : ChgType_Auto;
chsrc_determine_chgtype (ChgType_Auto);
chsrc_conclude (&source);
}

View File

@ -76,7 +76,7 @@ os_opensuse_setsrc (char *option)
chsrc_run (cmd5, RunOpt_Default);
chsrc_run (cmd6, RunOpt_Default);
ProgMode_ChgType = ChgType_Untested;
chsrc_determine_chgtype (ChgType_Untested);
chsrc_conclude (&source);
}

View File

@ -92,7 +92,8 @@ os_arch_setsrc (char *option)
{
chsrc_run ("pacman -Syy", RunOpt_No_Last_New_Line);
}
ProgMode_ChgType = ChgType_Auto;
chsrc_determine_chgtype (ChgType_Auto);
chsrc_conclude (&source);
}

View File

@ -48,7 +48,7 @@ os_msys2_setsrc (char *option)
chsrc_run (cmd, RunOpt_Default);
ProgMode_ChgType = ChgType_Untested;
chsrc_determine_chgtype (ChgType_Untested);
chsrc_conclude (&source);
}

View File

@ -20,7 +20,8 @@ os_manjaro_setsrc (char *option)
chsrc_run (cmd, RunOpt_Default);
chsrc_run ("pacman -Syy", RunOpt_No_Last_New_Line);
ProgMode_ChgType = ChgType_Auto;
chsrc_determine_chgtype (ChgType_Auto);
chsrc_conclude (NULL);
}

View File

@ -74,7 +74,7 @@ wr_anaconda_setsrc (char *option)
chsrc_note2 ("然后运行 conda clean -i 清除索引缓存,保证用的是镜像站提供的索引");
ProgMode_ChgType = ChgType_SemiAuto;
chsrc_determine_chgtype (ChgType_SemiAuto);
chsrc_conclude (&source);
}

View File

@ -38,7 +38,7 @@ wr_cocoapods_setsrc (char *option)
char *source_str = xy_strjoin (3, "source '", source.url, "'");
p(source_str);
ProgMode_ChgType = ChgType_Manual;
chsrc_determine_chgtype (ChgType_Manual);
chsrc_conclude (&source);
}

View File

@ -154,7 +154,7 @@ wr_dockerhub_setsrc (char *option)
puts (source.url);
}
ProgMode_ChgType = ChgType_Manual;
chsrc_determine_chgtype (ChgType_SemiAuto);
chsrc_conclude (&source);
}

View File

@ -38,7 +38,7 @@ wr_emacs_setsrc (char *option)
chsrc_note2 ("Emacs换源涉及Elisp,需要手动查阅并换源:");
p(source.url);
ProgMode_ChgType = ChgType_Manual;
chsrc_determine_chgtype (ChgType_Manual);
chsrc_conclude (&source);
}

View File

@ -37,7 +37,7 @@ wr_flathub_setsrc (char *option)
char *cmd = xy_2strjoin ("flatpak remote-modify flathub --url=", source.url);
chsrc_run (cmd, RunOpt_Default);
ProgMode_ChgType = ChgType_Auto;
chsrc_determine_chgtype (ChgType_Auto);
chsrc_conclude (&source);
}

View File

@ -34,7 +34,7 @@ wr_guix_setsrc (char *option)
chsrc_note2 ("为防止扰乱配置文件,请您手动写入以下内容到 ~/.config/guix/channels.scm 文件中");
p(file);
ProgMode_ChgType = ChgType_Manual;
chsrc_determine_chgtype (ChgType_Manual);
chsrc_conclude (&source);
}

View File

@ -81,7 +81,7 @@ wr_homebrew_setsrc (char *option)
chsrc_append_to_file (w, fishrc);
}
ProgMode_ChgType = ChgType_Auto;
chsrc_determine_chgtype (ChgType_Auto);
chsrc_conclude (&source);
chsrc_note2 ("请您重启终端使Homebrew环境变量生效");
}

View File

@ -56,7 +56,7 @@ wr_nix_setsrc (char *option)
chsrc_note2 ("若您使用的是NixOS,请额外添加下述内容至 configuration.nix 中");
p(cmd);
ProgMode_ChgType = ChgType_SemiAuto;
chsrc_determine_chgtype (ChgType_SemiAuto);
chsrc_conclude (&source);
}

View File

@ -78,7 +78,7 @@ wr_tex_setsrc (char *option)
chsrc_run (cmd, RunOpt_Default);
}
ProgMode_ChgType = ChgType_Untested;
chsrc_determine_chgtype (ChgType_Untested);
chsrc_conclude (&source);
}

View File

@ -37,7 +37,7 @@ wr_winget_setsrc (char *option)
chsrc_run ("winget source remove winget", RunOpt_Default);
chsrc_run (xy_2strjoin ("winget source add winget ", source.url), RunOpt_Default);
ProgMode_ChgType = ChgType_Auto;
chsrc_determine_chgtype (ChgType_Auto);
chsrc_conclude (&source);
}
@ -47,7 +47,7 @@ wr_winget_resetsrc (char *option)
{
chsrc_run ("winget source reset winget", RunOpt_Default);
ProgMode_ChgType = ChgType_Auto;
chsrc_determine_chgtype (ChgType_Reset);
chsrc_conclude (NULL);
}