diff --git a/src/framework/core.c b/src/framework/core.c index 3895f3e..5d1fb7b 100644 --- a/src/framework/core.c +++ b/src/framework/core.c @@ -30,6 +30,17 @@ int ProgMode_Leader_Selected_Index = -1; /* 此时 chsrc_run() 不再是recipe中指定要运行的一个外部命令,而是作为一个功能实现的支撑 */ bool ProgMode_Run_as_a_Service = false; +enum ChgType_t +{ + ChgType_Auto, + ChgType_Reset, + ChgType_SemiAuto, + ChgType_Manual, + ChgType_Untested +}; + +enum ChgType_t ProgMode_ChgType = ChgType_Auto; + /* 命令行选项 */ bool CliOpt_IPv6 = false; @@ -769,7 +780,7 @@ source_has_empty_url (Source_t *source) * 1. 用户指定某个 Mirror Code * 2. NULL: 用户什么都没指定 (将测速选择最快镜像) * 3. 用户给了一个 URL - * 4. SetsrcType_Reset + * 4. ChgType_Reset * 选用了Leader target * 5. ProgMode_Leader_Selected_Index 将给出所选索引 * @@ -846,11 +857,6 @@ confirm_source (Source_t *source) #define chsrc_yield_source_and_confirm(for_what) chsrc_yield_source(for_what);chsrc_confirm_source -#define SetsrcType_Auto "auto" -#define SetsrcType_Reset "reset" -#define SetsrcType_SemiAuto "semiauto" -#define SetsrcType_Manual "manual" -#define SetsrcType_Untested "untested" #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" @@ -876,22 +882,24 @@ confirm_source (Source_t *source) #define thank_mirror(msg) chsrc_log(xy_2strjoin(msg,purple(CliOpt_InEnglish?source->mirror->abbr:source->mirror->name))) /** - * @param source 可为NULL - * @param last_word 5种选择:SetsrcType_Auto | SetsrcType_Reset | SetsrcType_SemiAuto | SetsrcType_Manual | SetsrcType_Untested - * @translation Done + * @param source 可为NULL + * + * @param[g] ProgMode_ChgType */ void -chsrc_conclude (Source_t *source, const char *last_word) +chsrc_conclude (Source_t *source) { split_between_source_changing_process; - if ((ProgMode_CMD_Reset == true) || xy_streql (SetsrcType_Reset, last_word)) + // fprintf (stderr, "chsrc: now change type: %d\n", ProgMode_ChgType); + + if (ProgMode_CMD_Reset || ChgType_Reset == ProgMode_ChgType) { // source_is_upstream (source) char *msg = CliOpt_InEnglish ? "Has been reset to the upstream default source" : "已重置为上游默认源"; chsrc_log (purple (msg)); } - else if (xy_streql (SetsrcType_Auto, last_word)) + else if (ChgType_Auto == ProgMode_ChgType) { if (source) { @@ -914,7 +922,7 @@ chsrc_conclude (Source_t *source, const char *last_word) chsrc_log (msg); } } - else if (xy_streql (SetsrcType_SemiAuto, last_word)) + else if (ChgType_SemiAuto == ProgMode_ChgType) { if (source) { @@ -941,7 +949,7 @@ chsrc_conclude (Source_t *source, const char *last_word) char *msg = CliOpt_InEnglish ? MSG_EN_BETTER : MSG_CN_BETTER; chsrc_warn (msg); } - else if (xy_streql (SetsrcType_Manual, last_word)) + else if (ChgType_Manual == ProgMode_ChgType) { if (source) { @@ -966,7 +974,7 @@ chsrc_conclude (Source_t *source, const char *last_word) char *msg = CliOpt_InEnglish ? MSG_EN_BETTER : MSG_CN_BETTER; chsrc_warn (msg); } - else if (xy_streql (SetsrcType_Untested, last_word)) + else if (ChgType_Untested == ProgMode_ChgType) { if (source) { @@ -992,7 +1000,8 @@ chsrc_conclude (Source_t *source, const char *last_word) } else { - say (last_word); + fprintf (stderr, "chsrc: Wrong change type: %d\n", ProgMode_ChgType); + xy_unreach; } } diff --git a/src/recipe/lang/Clojure.c b/src/recipe/lang/Clojure.c index 091b7f2..7de509d 100644 --- a/src/recipe/lang/Clojure.c +++ b/src/recipe/lang/Clojure.c @@ -26,8 +26,9 @@ pl_clojure_setsrc (char *option) chsrc_yield_source_and_confirm (pl_clojure); chsrc_note2 ("抱歉,Clojure换源较复杂,您可手动查阅并换源:"); - puts (source.url); - chsrc_conclude (&source, SetsrcType_Manual); + say (source.url); + ProgMode_ChgType = ChgType_Manual; + chsrc_conclude (&source); } def_target_s (pl_clojure); diff --git a/src/recipe/lang/Dart/Flutter.c b/src/recipe/lang/Dart/Flutter.c index 35c50c4..7c7827e 100644 --- a/src/recipe/lang/Dart/Flutter.c +++ b/src/recipe/lang/Dart/Flutter.c @@ -83,14 +83,16 @@ pl_dart_flutter_setsrc (char *option) chsrc_append_to_file (w, bashrc); } } - chsrc_conclude (&source, SetsrcType_Auto); + + ProgMode_ChgType = ProgMode_CMD_Reset ? ChgType_Reset : ChgType_Auto; + chsrc_conclude (&source); } void pl_dart_flutter_resetsrc (char *option) { - pl_dart_flutter_setsrc (SetsrcType_Reset); + pl_dart_flutter_setsrc (option); } diff --git a/src/recipe/lang/Dart/Pub.c b/src/recipe/lang/Dart/Pub.c index 6c71ed0..0cbc59c 100644 --- a/src/recipe/lang/Dart/Pub.c +++ b/src/recipe/lang/Dart/Pub.c @@ -79,14 +79,16 @@ pl_dart_setsrc (char *option) chsrc_append_to_file (w, bashrc); } } - chsrc_conclude (&source, SetsrcType_Auto); + + ProgMode_ChgType = ProgMode_CMD_Reset ? ChgType_Reset : ChgType_Auto; + chsrc_conclude (&source); } void pl_dart_resetsrc (char *option) { - pl_dart_setsrc (SetsrcType_Reset); + pl_dart_setsrc (option); } diff --git a/src/recipe/lang/Go.c b/src/recipe/lang/Go.c index 16a9ad5..3f26313 100644 --- a/src/recipe/lang/Go.c +++ b/src/recipe/lang/Go.c @@ -76,7 +76,8 @@ pl_go_setsrc (char *option) cmd = xy_strjoin (3, "go env -w GOPROXY=", source.url, ",direct"); chsrc_run (cmd, RunOpt_Default); - chsrc_conclude (&source, SetsrcType_Auto); + ProgMode_ChgType = ProgMode_CMD_Reset ? ChgType_Reset : ChgType_Auto; + chsrc_conclude (&source); } /** diff --git a/src/recipe/lang/Haskell.c b/src/recipe/lang/Haskell.c index 5f658a3..4052f53 100644 --- a/src/recipe/lang/Haskell.c +++ b/src/recipe/lang/Haskell.c @@ -61,8 +61,9 @@ pl_haskell_setsrc (char *option) " ignore-expiry: no"); chsrc_note2 (xy_strjoin (3, "请向 ", config, " 中手动添加:")); - puts (file); - chsrc_conclude (&source, SetsrcType_Manual); + say (file); + ProgMode_ChgType = ChgType_Manual; + chsrc_conclude (&source); } def_target_s (pl_haskell); diff --git a/src/recipe/lang/Java.c b/src/recipe/lang/Java.c index 128b046..63a3f2c 100644 --- a/src/recipe/lang/Java.c +++ b/src/recipe/lang/Java.c @@ -93,9 +93,10 @@ pl_java_setsrc (char *option) "}"); chsrc_note2 ("请在您的 build.gradle 中添加:"); - puts (file); + say (file); } - chsrc_conclude (&source, SetsrcType_Manual); + ProgMode_ChgType = ChgType_Manual; + chsrc_conclude (&source); } def_target(pl_java); diff --git a/src/recipe/lang/Julia.c b/src/recipe/lang/Julia.c index 73b4e0b..954e9af 100644 --- a/src/recipe/lang/Julia.c +++ b/src/recipe/lang/Julia.c @@ -49,7 +49,8 @@ pl_julia_setsrc (char *option) chsrc_append_to_file (w, PL_Julia_Config); - chsrc_conclude (&source, SetsrcType_Untested); + ProgMode_ChgType = ChgType_Untested; + chsrc_conclude (&source); } diff --git a/src/recipe/lang/Lua.c b/src/recipe/lang/Lua.c index c9225d2..580436c 100644 --- a/src/recipe/lang/Lua.c +++ b/src/recipe/lang/Lua.c @@ -52,9 +52,10 @@ pl_lua_setsrc (char *option) "server = \"", source.url, "\""); chsrc_note2 ("请手动修改 ~/.luarocks/upload_config.lua 文件 (用于上传):"); - puts (upload_config); + say (upload_config); - chsrc_conclude (&source, SetsrcType_Manual); + ProgMode_ChgType = ChgType_Manual; + chsrc_conclude (&source); } def_target(pl_lua); diff --git a/src/recipe/lang/Node.js/Bun.c b/src/recipe/lang/Node.js/Bun.c index 3977eed..db7dda0 100644 --- a/src/recipe/lang/Node.js/Bun.c +++ b/src/recipe/lang/Node.js/Bun.c @@ -27,8 +27,6 @@ pl_nodejs_bun_getsrc (char *option) void pl_nodejs_bun_setsrc (char *option) { - char *setsrc_type = xy_streql (option, SetsrcType_Reset) ? SetsrcType_Reset : SetsrcType_Manual; - // 用的是 npm Registry 的源 chsrc_yield_source (pl_nodejs); @@ -44,8 +42,9 @@ pl_nodejs_bun_setsrc (char *option) chsrc_note2 (xy_strjoin (3, "请您手动写入以下内容到 ", xy_normalize_path ("~/.bunfig.toml"), " 文件中")); } - puts (file); - chsrc_conclude (&source, setsrc_type); + say (file); + ProgMode_ChgType = ProgMode_CMD_Reset ? ChgType_Reset : ChgType_Auto; + chsrc_conclude (&source); } @@ -55,7 +54,7 @@ pl_nodejs_bun_setsrc (char *option) void pl_nodejs_bun_resetsrc (char *option) { - pl_nodejs_bun_setsrc (SetsrcType_Reset); + pl_nodejs_bun_setsrc (option); } diff --git a/src/recipe/lang/Node.js/Node.js.c b/src/recipe/lang/Node.js/Node.js.c index abc5988..73b0c9b 100644 --- a/src/recipe/lang/Node.js/Node.js.c +++ b/src/recipe/lang/Node.js/Node.js.c @@ -94,7 +94,8 @@ pl_nodejs_setsrc (char *option) pl_nodejs_pnpm_setsrc (option); } - chsrc_conclude (&source, SetsrcType_Auto); + ProgMode_ChgType = ProgMode_CMD_Reset ? ChgType_Reset : ChgType_Auto; + chsrc_conclude (&source); } @@ -104,7 +105,7 @@ pl_nodejs_setsrc (char *option) void pl_nodejs_resetsrc (char *option) { - pl_nodejs_setsrc (SetsrcType_Reset); + pl_nodejs_setsrc (option); } diff --git a/src/recipe/lang/Node.js/Yarn.c b/src/recipe/lang/Node.js/Yarn.c index 2ca1f9c..3216070 100644 --- a/src/recipe/lang/Node.js/Yarn.c +++ b/src/recipe/lang/Node.js/Yarn.c @@ -72,7 +72,10 @@ pl_nodejs_yarn_setsrc (char *option) } if (ProgMode_Target_Group!=true) - chsrc_conclude (&source, SetsrcType_Auto); + { + ProgMode_ChgType = ProgMode_CMD_Reset ? ChgType_Reset : ChgType_Auto; + chsrc_conclude (&source); + } } @@ -82,7 +85,7 @@ pl_nodejs_yarn_setsrc (char *option) void pl_nodejs_yarn_resetsrc (char *option) { - pl_nodejs_yarn_setsrc (SetsrcType_Reset); + pl_nodejs_yarn_setsrc (option); } diff --git a/src/recipe/lang/Node.js/npm.c b/src/recipe/lang/Node.js/npm.c index 526b926..d0dc5d0 100644 --- a/src/recipe/lang/Node.js/npm.c +++ b/src/recipe/lang/Node.js/npm.c @@ -41,7 +41,10 @@ pl_nodejs_npm_setsrc (char *option) chsrc_run (cmd, RunOpt_No_Last_New_Line); if (ProgMode_Target_Group!=true) - chsrc_conclude (&source, SetsrcType_Auto); + { + ProgMode_ChgType = ProgMode_CMD_Reset ? ChgType_Reset : ChgType_Auto; + chsrc_conclude (&source); + } } @@ -51,7 +54,7 @@ pl_nodejs_npm_setsrc (char *option) void pl_nodejs_npm_resetsrc (char *option) { - pl_nodejs_npm_setsrc (SetsrcType_Reset); + pl_nodejs_npm_setsrc (option); } diff --git a/src/recipe/lang/Node.js/nvm.c b/src/recipe/lang/Node.js/nvm.c index 364a753..8bc88bd 100644 --- a/src/recipe/lang/Node.js/nvm.c +++ b/src/recipe/lang/Node.js/nvm.c @@ -42,7 +42,8 @@ pl_nodejs_nvm_setsrc (char *option) if (xy_file_exist (zshrc)) chsrc_append_to_file (w, zshrc); - chsrc_conclude (&source, SetsrcType_Auto); + ProgMode_ChgType = ProgMode_CMD_Reset ? ChgType_Reset : ChgType_Auto; + chsrc_conclude (&source); } @@ -52,7 +53,7 @@ pl_nodejs_nvm_setsrc (char *option) void pl_nodejs_nvm_resetsrc (char *option) { - // pl_nodejs_nvm_setsrc (SetsrcType_Reset); + // pl_nodejs_nvm_setsrc (ChgType_Reset); chsrc_error ("暂不支持对 nvm 重置"); exit (Exit_Unsupported); } diff --git a/src/recipe/lang/Node.js/pnpm.c b/src/recipe/lang/Node.js/pnpm.c index 3dd350b..90b0341 100644 --- a/src/recipe/lang/Node.js/pnpm.c +++ b/src/recipe/lang/Node.js/pnpm.c @@ -42,7 +42,10 @@ pl_nodejs_pnpm_setsrc (char *option) chsrc_run (cmd, RunOpt_No_Last_New_Line); if (ProgMode_Target_Group!=true) - chsrc_conclude (&source, SetsrcType_Auto); + { + ProgMode_ChgType = ProgMode_CMD_Reset ? ChgType_Reset : ChgType_Auto; + chsrc_conclude (&source); + } } @@ -52,7 +55,7 @@ pl_nodejs_pnpm_setsrc (char *option) void pl_nodejs_pnpm_resetsrc (char *option) { - pl_nodejs_pnpm_setsrc (SetsrcType_Reset); + pl_nodejs_pnpm_setsrc (option); } diff --git a/src/recipe/lang/OCaml.c b/src/recipe/lang/OCaml.c index 2e20455..8224485 100644 --- a/src/recipe/lang/OCaml.c +++ b/src/recipe/lang/OCaml.c @@ -48,9 +48,10 @@ pl_ocaml_setsrc(char *option) chsrc_run (cmd, RunOpt_Default); chsrc_note2 ("如果是首次使用 opam ,请使用以下命令进行初始化"); - puts (xy_2strjoin ("opam init default ", source.url)); + say (xy_2strjoin ("opam init default ", source.url)); - chsrc_conclude (&source, SetsrcType_SemiAuto); + ProgMode_ChgType = ChgType_SemiAuto; + chsrc_conclude (&source); } def_target(pl_ocaml); diff --git a/src/recipe/lang/PHP.c b/src/recipe/lang/PHP.c index 76cdaf9..d63ccf5 100644 --- a/src/recipe/lang/PHP.c +++ b/src/recipe/lang/PHP.c @@ -4,7 +4,7 @@ * File Authors : Aoran Zeng * Contributors : Nil Null * Created On : <2023-08-30> - * Last Modified : <2024-09-14> + * Last Modified : <2024-11-22> * ------------------------------------------------------------*/ /** @@ -39,7 +39,7 @@ pl_php_getsrc (char *option) } /** - * PHP 换源,参考:https://developer.aliyun.com/composer + * @consult https://developer.aliyun.com/composer */ void pl_php_setsrc (char *option) @@ -57,7 +57,8 @@ pl_php_setsrc (char *option) char *cmd = xy_strjoin (4, "composer config", where, "repo.packagist composer ", source.url); chsrc_run (cmd, RunOpt_Default); - chsrc_conclude (&source, SetsrcType_SemiAuto); + ProgMode_ChgType = ChgType_Auto; + chsrc_conclude (&source); } diff --git a/src/recipe/lang/Perl.c b/src/recipe/lang/Perl.c index 2a71b72..d4331b5 100644 --- a/src/recipe/lang/Perl.c +++ b/src/recipe/lang/Perl.c @@ -54,8 +54,10 @@ pl_perl_setsrc (char *option) chsrc_run (cmd, RunOpt_Default); chsrc_note2 ("请您使用 perl -v 以及 cpan -v,若 Perl >= v5.36 或 CPAN >= 2.29,请额外手动调用下面的命令"); - puts ("perl -MCPAN -e \"CPAN::HandleConfig->load(); CPAN::HandleConfig->edit('pushy_https', 0);; CPAN::HandleConfig->commit()\""); - chsrc_conclude (&source, SetsrcType_SemiAuto); + say ("perl -MCPAN -e \"CPAN::HandleConfig->load(); CPAN::HandleConfig->edit('pushy_https', 0);; CPAN::HandleConfig->commit()\""); + + ProgMode_ChgType = ChgType_SemiAuto; + chsrc_conclude (&source); } def_target(pl_perl); diff --git a/src/recipe/lang/Python/PDM.c b/src/recipe/lang/Python/PDM.c index e720d8d..292ec7b 100644 --- a/src/recipe/lang/Python/PDM.c +++ b/src/recipe/lang/Python/PDM.c @@ -43,7 +43,10 @@ pl_python_pdm_setsrc (char *option) chsrc_run (cmd, RunOpt_No_Last_New_Line); if (ProgMode_Target_Group!=true) - chsrc_conclude (&source, SetsrcType_Auto); + { + ProgMode_ChgType = ProgMode_CMD_Reset ? ChgType_Reset : ChgType_Auto; + chsrc_conclude (&source); + } } @@ -53,7 +56,7 @@ pl_python_pdm_setsrc (char *option) void pl_python_pdm_resetsrc (char *option) { - pl_python_pdm_setsrc (SetsrcType_Reset); + pl_python_pdm_setsrc (option); } diff --git a/src/recipe/lang/Python/Poetry.c b/src/recipe/lang/Python/Poetry.c index 33a9f43..7e5f4a9 100644 --- a/src/recipe/lang/Python/Poetry.c +++ b/src/recipe/lang/Python/Poetry.c @@ -41,7 +41,10 @@ pl_python_poetry_setsrc (char *option) chsrc_run (cmd, RunOpt_No_Last_New_Line); if (ProgMode_Target_Group!=true) - chsrc_conclude (&source, SetsrcType_Auto); + { + ProgMode_ChgType = ProgMode_CMD_Reset ? ChgType_Reset : ChgType_Auto; + chsrc_conclude (&source); + } } @@ -51,7 +54,7 @@ pl_python_poetry_setsrc (char *option) void pl_python_poetry_resetsrc (char *option) { - pl_python_poetry_setsrc (SetsrcType_Reset); + pl_python_poetry_setsrc (option); } diff --git a/src/recipe/lang/Python/Python.c b/src/recipe/lang/Python/Python.c index 9237bc3..c1617a8 100644 --- a/src/recipe/lang/Python/Python.c +++ b/src/recipe/lang/Python/Python.c @@ -45,8 +45,6 @@ pl_python_setsrc (char *option) chsrc_note2 (msg); } - char *setsrc_type = xy_streql (option, SetsrcType_Reset) ? SetsrcType_Reset : SetsrcType_Auto; - bool pdm_exist = false, poetry_exist = false; @@ -71,13 +69,14 @@ pl_python_setsrc (char *option) pl_python_pdm_setsrc (option); } - chsrc_conclude (&source, setsrc_type); + ProgMode_ChgType = ProgMode_CMD_Reset ? ChgType_Reset : ChgType_Auto; + chsrc_conclude (&source); } void pl_python_resetsrc (char *option) { - pl_python_setsrc (SetsrcType_Reset); + pl_python_setsrc (option); } diff --git a/src/recipe/lang/Python/pip.c b/src/recipe/lang/Python/pip.c index ce6924f..fc953ef 100644 --- a/src/recipe/lang/Python/pip.c +++ b/src/recipe/lang/Python/pip.c @@ -53,7 +53,10 @@ pl_python_pip_setsrc (char *option) chsrc_run (cmd, RunOpt_No_Last_New_Line); if (ProgMode_Target_Group!=true) - chsrc_conclude (&source, SetsrcType_Auto); + { + ProgMode_ChgType = ProgMode_CMD_Reset ? ChgType_Reset : ChgType_Auto; + chsrc_conclude (&source); + } } @@ -63,7 +66,7 @@ pl_python_pip_setsrc (char *option) void pl_python_pip_resetsrc (char *option) { - pl_python_pip_setsrc (SetsrcType_Reset); + pl_python_pip_setsrc (option); } diff --git a/src/recipe/lang/R.c b/src/recipe/lang/R.c index 3c96b12..a92e763 100644 --- a/src/recipe/lang/R.c +++ b/src/recipe/lang/R.c @@ -71,7 +71,8 @@ pl_r_setsrc (char *option) chsrc_append_to_file (w, config); - chsrc_conclude (&source, SetsrcType_Auto); + ProgMode_ChgType = ChgType_Auto; + chsrc_conclude (&source); } def_target(pl_r); diff --git a/src/recipe/lang/Ruby.c b/src/recipe/lang/Ruby.c index 84f5430..16d3f92 100644 --- a/src/recipe/lang/Ruby.c +++ b/src/recipe/lang/Ruby.c @@ -62,8 +62,6 @@ pl_ruby_remove_gem_source (const char *source) void pl_ruby_setsrc (char *option) { - char *setsrc_type = xy_streql (option, SetsrcType_Reset) ? SetsrcType_Reset : SetsrcType_Auto; - chsrc_ensure_program ("gem"); chsrc_yield_source_and_confirm (pl_ruby); @@ -87,13 +85,14 @@ 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); - chsrc_conclude (&source, setsrc_type); + ProgMode_ChgType = ProgMode_CMD_Reset ? ChgType_Reset : ChgType_Auto; + chsrc_conclude (&source); } void pl_ruby_resetsrc (char *option) { - pl_ruby_setsrc (SetsrcType_Reset); + pl_ruby_setsrc (option); } diff --git a/src/recipe/lang/Rust/Cargo.c b/src/recipe/lang/Rust/Cargo.c index ca615b7..caaa46a 100644 --- a/src/recipe/lang/Rust/Cargo.c +++ b/src/recipe/lang/Rust/Cargo.c @@ -55,8 +55,9 @@ pl_rust_cargo_setsrc (char *option) "registry = \"sparse+", source.url, "\""); chsrc_note2 (xy_strjoin (3, "请您手动写入以下内容到 ", xy_normalize_path ("~/.cargo/config.toml"), " 文件中:")); - puts (file); - chsrc_conclude (&source, SetsrcType_Manual); + say (file); + ProgMode_ChgType = ProgMode_CMD_Reset ? ChgType_Reset : ChgType_Auto; + chsrc_conclude (&source); } @@ -66,7 +67,7 @@ pl_rust_cargo_setsrc (char *option) void pl_rust_cargo_resetsrc (char *option) { - pl_rust_cargo_setsrc (SetsrcType_Reset); + pl_rust_cargo_setsrc (option); } diff --git a/src/recipe/lang/Rust/rustup.c b/src/recipe/lang/Rust/rustup.c index 9e00510..7e6991e 100644 --- a/src/recipe/lang/Rust/rustup.c +++ b/src/recipe/lang/Rust/rustup.c @@ -45,8 +45,6 @@ pl_rust_rustup_getsrc (char *option) void pl_rust_rustup_setsrc (char *option) { - char *setsrc_type = xy_streql (option, SetsrcType_Reset) ? SetsrcType_Reset : SetsrcType_Auto; - chsrc_yield_source_and_confirm (pl_rust_rustup); char *w1 = xy_strjoin (3, "export RUSTUP_DIST_SERVER=\"", source.url, "\"\n"); @@ -80,7 +78,8 @@ pl_rust_rustup_setsrc (char *option) chsrc_append_to_file (w, fishrc); } - chsrc_conclude (&source, setsrc_type); + ProgMode_ChgType = ProgMode_CMD_Reset ? ChgType_Reset : ChgType_Auto; + chsrc_conclude (&source); chsrc_note2 ("请您重启终端使rustup环境变量生效"); } @@ -91,7 +90,7 @@ pl_rust_rustup_setsrc (char *option) void pl_rust_rustup_resetsrc (char *option) { - pl_rust_rustup_setsrc (SetsrcType_Reset); + pl_rust_rustup_setsrc (option); } diff --git a/src/recipe/os/APT/Armbian.c b/src/recipe/os/APT/Armbian.c index ba46574..a24a93f 100644 --- a/src/recipe/os/APT/Armbian.c +++ b/src/recipe/os/APT/Armbian.c @@ -57,7 +57,9 @@ os_armbian_setsrc (char *option) chsrc_run (cmd, RunOpt_Default); chsrc_run ("apt update", RunOpt_No_Last_New_Line); - chsrc_conclude (&source, SetsrcType_Auto); + + ProgMode_ChgType = ChgType_Auto; + chsrc_conclude (&source); } diff --git a/src/recipe/os/APT/Debian.c b/src/recipe/os/APT/Debian.c index bc388df..01cf91c 100644 --- a/src/recipe/os/APT/Debian.c +++ b/src/recipe/os/APT/Debian.c @@ -66,7 +66,9 @@ os_debian_setsrc_for_deb822 (char *option) chsrc_run (cmd, RunOpt_Default); chsrc_run ("apt update", RunOpt_No_Last_New_Line); - chsrc_conclude (&source, SetsrcType_Auto); + + ProgMode_ChgType = ChgType_Auto; + chsrc_conclude (&source); } @@ -105,7 +107,9 @@ os_debian_setsrc (char *option) chsrc_run (cmd, RunOpt_Default); chsrc_run ("apt update", RunOpt_No_Last_New_Line); - chsrc_conclude (&source, SetsrcType_Auto); + + ProgMode_ChgType = ChgType_Auto; + chsrc_conclude (&source); } diff --git a/src/recipe/os/APT/Kali-Linux.c b/src/recipe/os/APT/Kali-Linux.c index cd36f77..b1bd7dc 100644 --- a/src/recipe/os/APT/Kali-Linux.c +++ b/src/recipe/os/APT/Kali-Linux.c @@ -53,7 +53,9 @@ os_kali_setsrc (char *option) chsrc_run (cmd, RunOpt_Default); chsrc_run ("apt update", RunOpt_No_Last_New_Line); - chsrc_conclude (&source, SetsrcType_Untested); + + ProgMode_ChgType = ChgType_Untested; + chsrc_conclude (&source); } def_target(os_kali); diff --git a/src/recipe/os/APT/Linux-Lite.c b/src/recipe/os/APT/Linux-Lite.c index e16ff0e..7e5e541 100644 --- a/src/recipe/os/APT/Linux-Lite.c +++ b/src/recipe/os/APT/Linux-Lite.c @@ -42,7 +42,9 @@ os_linuxlite_setsrc (char *option) char *cmd = xy_strjoin (3, "sed -E -i 's@https?://.*/.*/?@", source.url, "@g' " OS_Apt_SourceList); chsrc_run ("apt update", RunOpt_No_Last_New_Line); - chsrc_conclude (&source, SetsrcType_Auto); + + ProgMode_ChgType = ChgType_Auto; + chsrc_conclude (&source); } def_target(os_linuxlite); diff --git a/src/recipe/os/APT/Linux-Mint.c b/src/recipe/os/APT/Linux-Mint.c index 0cbb10b..2e7670a 100644 --- a/src/recipe/os/APT/Linux-Mint.c +++ b/src/recipe/os/APT/Linux-Mint.c @@ -54,7 +54,9 @@ os_linuxmint_setsrc (char *option) chsrc_run (cmd, RunOpt_Default); chsrc_run ("apt update", RunOpt_No_Last_New_Line); - chsrc_conclude (&source, SetsrcType_Auto); + + ProgMode_ChgType = ChgType_Auto; + chsrc_conclude (&source); chsrc_warn2 ("完成后请不要再使用 mintsources(自带的图形化软件源设置工具)进行任何操作,因为在操作后,无论是否有按“确定”,mintsources 均会覆写我们刚才换源的内容"); } diff --git a/src/recipe/os/APT/ROS.c b/src/recipe/os/APT/ROS.c index fb19a64..4241468 100644 --- a/src/recipe/os/APT/ROS.c +++ b/src/recipe/os/APT/ROS.c @@ -46,7 +46,9 @@ os_ros_setsrc (char *option) chsrc_run (cmd, RunOpt_Default); chsrc_run ("apt update", RunOpt_No_Last_New_Line); - chsrc_conclude (&source, SetsrcType_Untested); + + ProgMode_ChgType = ChgType_Untested; + chsrc_conclude (&source); } def_target_s(os_ros); diff --git a/src/recipe/os/APT/Raspberry-Pi-OS.c b/src/recipe/os/APT/Raspberry-Pi-OS.c index 5058bc6..13b7b9e 100644 --- a/src/recipe/os/APT/Raspberry-Pi-OS.c +++ b/src/recipe/os/APT/Raspberry-Pi-OS.c @@ -44,7 +44,9 @@ os_raspberrypi_setsrc (char *option) chsrc_run (cmd, RunOpt_Default); chsrc_run ("apt update", RunOpt_No_Last_New_Line); - chsrc_conclude (&source, SetsrcType_Untested); + + ProgMode_ChgType = ChgType_Untested; + chsrc_conclude (&source); } def_target(os_raspberrypi); diff --git a/src/recipe/os/APT/Trisquel.c b/src/recipe/os/APT/Trisquel.c index 890baf9..f388115 100644 --- a/src/recipe/os/APT/Trisquel.c +++ b/src/recipe/os/APT/Trisquel.c @@ -46,7 +46,9 @@ os_trisquel_setsrc (char *option) chsrc_run (cmd, RunOpt_Default); chsrc_run ("apt update", RunOpt_No_Last_New_Line); - chsrc_conclude (&source, SetsrcType_Untested); + + ProgMode_ChgType = ChgType_Untested; + chsrc_conclude (&source); } def_target(os_trisquel); diff --git a/src/recipe/os/APT/Ubuntu.c b/src/recipe/os/APT/Ubuntu.c index 0148ec9..375125f 100644 --- a/src/recipe/os/APT/Ubuntu.c +++ b/src/recipe/os/APT/Ubuntu.c @@ -75,7 +75,9 @@ os_ubuntu_setsrc_for_deb822 (char *option) chsrc_run (cmd, RunOpt_Default); chsrc_run ("apt update", RunOpt_No_Last_New_Line); - chsrc_conclude (&source, SetsrcType_Auto); + + ProgMode_ChgType = ChgType_Auto; + chsrc_conclude (&source); } /** @@ -118,7 +120,9 @@ os_ubuntu_setsrc (char *option) chsrc_run (cmd, RunOpt_Default); chsrc_run ("apt update", RunOpt_No_Last_New_Line); - chsrc_conclude (&source, SetsrcType_Auto); + + ProgMode_ChgType = ChgType_Auto; + chsrc_conclude (&source); } diff --git a/src/recipe/os/APT/deepin.c b/src/recipe/os/APT/deepin.c index f1565c9..fbc2492 100644 --- a/src/recipe/os/APT/deepin.c +++ b/src/recipe/os/APT/deepin.c @@ -51,7 +51,9 @@ os_deepin_setsrc (char *option) chsrc_run (cmd, RunOpt_Default); chsrc_run ("apt update", RunOpt_No_Last_New_Line); - chsrc_conclude (&source, SetsrcType_Untested); + + ProgMode_ChgType = ChgType_Untested; + chsrc_conclude (&source); } def_target(os_deepin); diff --git a/src/recipe/os/APT/openKylin.c b/src/recipe/os/APT/openKylin.c index ddb8349..f51ca1d 100644 --- a/src/recipe/os/APT/openKylin.c +++ b/src/recipe/os/APT/openKylin.c @@ -39,7 +39,9 @@ os_openkylin_setsrc (char *option) char *cmd = xy_strjoin (3, "sed -E -i 's@https?://.*/openkylin/?@", source.url, "@g'" OS_Apt_SourceList); chsrc_run (cmd, RunOpt_Default); chsrc_run ("apt update", RunOpt_No_Last_New_Line); - chsrc_conclude (&source, SetsrcType_Untested); + + ProgMode_ChgType = ChgType_Untested; + chsrc_conclude (&source); } def_target(os_openkylin); diff --git a/src/recipe/os/Alpine-Linux.c b/src/recipe/os/Alpine-Linux.c index 59ac23f..4cbaefa 100644 --- a/src/recipe/os/Alpine-Linux.c +++ b/src/recipe/os/Alpine-Linux.c @@ -48,7 +48,9 @@ os_alpine_setsrc (char *option) chsrc_run (cmd, RunOpt_Default); chsrc_run ("apk update", RunOpt_No_Last_New_Line); - chsrc_conclude (&source, SetsrcType_Untested); + + ProgMode_ChgType = ChgType_Untested; + chsrc_conclude (&source); } def_target(os_alpine); diff --git a/src/recipe/os/BSD/FreeBSD.c b/src/recipe/os/BSD/FreeBSD.c index 7d8421b..da5cb60 100644 --- a/src/recipe/os/BSD/FreeBSD.c +++ b/src/recipe/os/BSD/FreeBSD.c @@ -128,7 +128,8 @@ os_freebsd_setsrc (char *option) chsrc_overwrite_file (update, "/etc/freebsd-update.conf"); */ - chsrc_conclude (&source, SetsrcType_SemiAuto); + ProgMode_ChgType = ChgType_SemiAuto; + chsrc_conclude (&source); } def_target_s(os_freebsd); diff --git a/src/recipe/os/BSD/NetBSD.c b/src/recipe/os/BSD/NetBSD.c index f4e28b3..698db42 100644 --- a/src/recipe/os/BSD/NetBSD.c +++ b/src/recipe/os/BSD/NetBSD.c @@ -58,7 +58,8 @@ 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"); - chsrc_conclude (&source, SetsrcType_Untested); + ProgMode_ChgType = ChgType_Untested; + chsrc_conclude (&source); } def_target(os_netbsd); diff --git a/src/recipe/os/BSD/OpenBSD.c b/src/recipe/os/BSD/OpenBSD.c index 612c2aa..aea14a8 100644 --- a/src/recipe/os/BSD/OpenBSD.c +++ b/src/recipe/os/BSD/OpenBSD.c @@ -47,7 +47,8 @@ os_openbsd_setsrc (char *option) chsrc_backup ("/etc/installurl"); chsrc_overwrite_file (source.url, "/etc/installurl"); - chsrc_conclude (&source, SetsrcType_Untested); + ProgMode_ChgType = ChgType_Untested; + chsrc_conclude (&source); } def_target(os_openbsd); diff --git a/src/recipe/os/Gentoo-Linux.c b/src/recipe/os/Gentoo-Linux.c index 2667685..d834910 100644 --- a/src/recipe/os/Gentoo-Linux.c +++ b/src/recipe/os/Gentoo-Linux.c @@ -45,7 +45,9 @@ os_gentoo_setsrc (char *option) char *w = xy_strjoin (3, "GENTOO_MIRRORS=\"https://", source.url, "gentoo\"\n"); chsrc_append_to_file (w, "/etc/portage/make.conf"); - chsrc_conclude (&source, SetsrcType_Untested); + + ProgMode_ChgType = ChgType_Untested; + chsrc_conclude (&source); } def_target_s(os_gentoo); diff --git a/src/recipe/os/OpenWrt.c b/src/recipe/os/OpenWrt.c index 06ca4fe..d27e2b4 100644 --- a/src/recipe/os/OpenWrt.c +++ b/src/recipe/os/OpenWrt.c @@ -50,7 +50,9 @@ os_openwrt_setsrc (char *option) char *cmd = xy_strjoin (3, "sed -E -i 's@https?://.*downloads.openwrt.org@", source.url, "@g' " OS_OpenWRT_SourceConfig); chsrc_run ("apt update", RunOpt_No_Last_New_Line); - chsrc_conclude (&source, SetsrcType_Auto); + + ProgMode_ChgType = ChgType_Auto; + chsrc_conclude (&source); } diff --git a/src/recipe/os/Solus.c b/src/recipe/os/Solus.c index 20bd8e7..0ee8080 100644 --- a/src/recipe/os/Solus.c +++ b/src/recipe/os/Solus.c @@ -32,7 +32,9 @@ os_solus_setsrc (char *option) char *cmd = xy_2strjoin ("eopkg add-repo Solus ", source.url); chsrc_run (cmd, RunOpt_Default); - chsrc_conclude (&source, SetsrcType_Auto); + + ProgMode_ChgType = ChgType_Auto; + chsrc_conclude (&source); } def_target_s(os_solus); diff --git a/src/recipe/os/Void-Linux.c b/src/recipe/os/Void-Linux.c index 749fdc6..c4b879f 100644 --- a/src/recipe/os/Void-Linux.c +++ b/src/recipe/os/Void-Linux.c @@ -52,7 +52,8 @@ os_void_setsrc (char *option) chsrc_note2 ("若报错可尝试使用以下命令:"); say (cmd); - chsrc_conclude (&source, SetsrcType_Untested); + ProgMode_ChgType = ChgType_Untested; + chsrc_conclude (&source); } def_target(os_void); diff --git a/src/recipe/os/YUM/AlmaLinux.c b/src/recipe/os/YUM/AlmaLinux.c index 31cc6cc..bfc0029 100644 --- a/src/recipe/os/YUM/AlmaLinux.c +++ b/src/recipe/os/YUM/AlmaLinux.c @@ -36,7 +36,9 @@ os_almalinux_setsrc (char *option) chsrc_run (cmd, RunOpt_Default); chsrc_run ("dnf makecache", RunOpt_No_Last_New_Line); - chsrc_conclude (&source, SetsrcType_Auto); + + ProgMode_ChgType = ChgType_Auto; + chsrc_conclude (&source); } def_target_s(os_almalinux); diff --git a/src/recipe/os/YUM/Anolis-OS.c b/src/recipe/os/YUM/Anolis-OS.c index ebb4725..42b6374 100644 --- a/src/recipe/os/YUM/Anolis-OS.c +++ b/src/recipe/os/YUM/Anolis-OS.c @@ -36,7 +36,9 @@ os_anolis_setsrc (char *option) chsrc_run ("dnf makecache", RunOpt_Default); chsrc_run ("dnf update", RunOpt_No_Last_New_Line); - chsrc_conclude (&source, SetsrcType_Untested); + + ProgMode_ChgType = ChgType_Untested; + chsrc_conclude (&source); } def_target_s(os_anolis); diff --git a/src/recipe/os/YUM/Fedora-Linux.c b/src/recipe/os/YUM/Fedora-Linux.c index 3ee123d..aaee354 100644 --- a/src/recipe/os/YUM/Fedora-Linux.c +++ b/src/recipe/os/YUM/Fedora-Linux.c @@ -37,8 +37,6 @@ def_sources_n(os_fedora); void os_fedora_setsrc (char *option) { - char *setsrc_type = xy_streql (option, SetsrcType_Reset) ? SetsrcType_Reset : SetsrcType_Auto; - chsrc_ensure_root (); chsrc_yield_source_and_confirm (os_fedora); @@ -74,14 +72,15 @@ os_fedora_setsrc (char *option) chsrc_run ("dnf makecache", RunOpt_No_Last_New_Line); - chsrc_conclude (&source, setsrc_type); + ProgMode_ChgType = ProgMode_CMD_Reset ? ChgType_Reset : ChgType_Auto; + chsrc_conclude (&source); } void os_fedora_resetsrc (char *option) { - os_fedora_setsrc (SetsrcType_Reset); + os_fedora_setsrc (option); } diff --git a/src/recipe/os/YUM/Rocky-Linux.c b/src/recipe/os/YUM/Rocky-Linux.c index 49421b7..0c33636 100644 --- a/src/recipe/os/YUM/Rocky-Linux.c +++ b/src/recipe/os/YUM/Rocky-Linux.c @@ -67,7 +67,9 @@ os_rockylinux_setsrc (char *option) chsrc_run (cmd, RunOpt_Default); chsrc_run ("dnf makecache", RunOpt_No_Last_New_Line); - chsrc_conclude (&source, SetsrcType_Auto); + + ProgMode_ChgType = ChgType_Auto; + chsrc_conclude (&source); } diff --git a/src/recipe/os/YUM/openEuler.c b/src/recipe/os/YUM/openEuler.c index f386670..1ca1dba 100644 --- a/src/recipe/os/YUM/openEuler.c +++ b/src/recipe/os/YUM/openEuler.c @@ -44,7 +44,9 @@ os_openeuler_setsrc (char *option) chsrc_overwrite_file (towrite, OS_openEuler_SourceList); chsrc_run ("dnf makecache", RunOpt_No_Last_New_Line); - chsrc_conclude (&source, SetsrcType_Auto); + + ProgMode_ChgType = ChgType_Auto; + chsrc_conclude (&source); } def_target_s(os_openeuler); diff --git a/src/recipe/os/openSUSE.c b/src/recipe/os/openSUSE.c index 71f92f9..808c6aa 100644 --- a/src/recipe/os/openSUSE.c +++ b/src/recipe/os/openSUSE.c @@ -75,7 +75,9 @@ os_opensuse_setsrc (char *option) chsrc_run (cmd5, RunOpt_Default); chsrc_run (cmd6, RunOpt_Default); - chsrc_conclude (&source, SetsrcType_Untested); + + ProgMode_ChgType = ChgType_Untested; + chsrc_conclude (&source); } def_target_s(os_opensuse); diff --git a/src/recipe/os/pacman/Arch-Linux.c b/src/recipe/os/pacman/Arch-Linux.c index 1aeb5a3..04fa104 100644 --- a/src/recipe/os/pacman/Arch-Linux.c +++ b/src/recipe/os/pacman/Arch-Linux.c @@ -91,7 +91,8 @@ os_arch_setsrc (char *option) { chsrc_run ("pacman -Syy", RunOpt_No_Last_New_Line); } - chsrc_conclude (&source, SetsrcType_Auto); + ProgMode_ChgType = ChgType_Auto; + chsrc_conclude (&source); } @@ -124,7 +125,9 @@ os_archlinuxcn_setsrc (char *option) chsrc_run ("pacman -Sy archlinuxcn-keyring", RunOpt_Default); chsrc_run ("pacman -Syy", RunOpt_No_Last_New_Line); - chsrc_conclude (&source, SetsrcType_Untested); + + ProgMode_ChgType = ChgType_Untested; + chsrc_conclude (&source); } #undef OS_Pacman_MirrorList diff --git a/src/recipe/os/pacman/MSYS2.c b/src/recipe/os/pacman/MSYS2.c index 32e9573..4b71f1d 100644 --- a/src/recipe/os/pacman/MSYS2.c +++ b/src/recipe/os/pacman/MSYS2.c @@ -47,7 +47,9 @@ os_msys2_setsrc (char *option) "#g\" /etc/pacman.d/mirrorlist* "); chsrc_run (cmd, RunOpt_Default); - chsrc_conclude (&source, SetsrcType_Untested); + + ProgMode_ChgType = ChgType_Untested; + chsrc_conclude (&source); } def_target_s(os_msys2); diff --git a/src/recipe/os/pacman/Manjaro-Linux.c b/src/recipe/os/pacman/Manjaro-Linux.c index 085a59c..ea1e2e8 100644 --- a/src/recipe/os/pacman/Manjaro-Linux.c +++ b/src/recipe/os/pacman/Manjaro-Linux.c @@ -20,7 +20,8 @@ os_manjaro_setsrc (char *option) chsrc_run (cmd, RunOpt_Default); chsrc_run ("pacman -Syy", RunOpt_No_Last_New_Line); - chsrc_conclude (NULL, SetsrcType_Auto); + ProgMode_ChgType = ChgType_Auto; + chsrc_conclude (NULL); } Target_t os_manjaro_target = {NULL, os_manjaro_setsrc, NULL, NULL, 0}; diff --git a/src/recipe/recipe-template.c b/src/recipe/recipe-template.c index b7b275c..4a77d9c 100644 --- a/src/recipe/recipe-template.c +++ b/src/recipe/recipe-template.c @@ -77,13 +77,14 @@ void void __setsrc (char *option) { - // 下面这行是必须的,注入source变量 + /* 下面这行是必须的,注入source变量 */ chsrc_yield_source_and_confirm (_); /* 具体的换源步骤,如调用第三方命令... */ - // 最后总结输出 - chsrc_conclude (&source, setsrc_type); + /* 最后总结输出 */ + ProgMode_ChgType = ChgType_; + chsrc_conclude (&source); } diff --git a/src/recipe/ware/Anaconda.c b/src/recipe/ware/Anaconda.c index e653024..29a4eca 100644 --- a/src/recipe/ware/Anaconda.c +++ b/src/recipe/ware/Anaconda.c @@ -67,7 +67,9 @@ wr_anaconda_setsrc (char *option) puts (file); chsrc_note2 ("然后运行 conda clean -i 清除索引缓存,保证用的是镜像站提供的索引"); - chsrc_conclude (&source, SetsrcType_SemiAuto); + + ProgMode_ChgType = ChgType_SemiAuto; + chsrc_conclude (&source); } def_target_s (wr_anaconda); diff --git a/src/recipe/ware/CocoaPods.c b/src/recipe/ware/CocoaPods.c index 9f0430e..3118810 100644 --- a/src/recipe/ware/CocoaPods.c +++ b/src/recipe/ware/CocoaPods.c @@ -38,7 +38,8 @@ wr_cocoapods_setsrc (char *option) char *source_str = xy_strjoin (3, "source '", source.url, "'"); say (source_str); - chsrc_conclude (&source, SetsrcType_Manual); + ProgMode_ChgType = ChgType_Manual; + chsrc_conclude (&source); } def_target_s (wr_cocoapods); diff --git a/src/recipe/ware/Docker-Hub.c b/src/recipe/ware/Docker-Hub.c index b794d33..6d191b6 100644 --- a/src/recipe/ware/Docker-Hub.c +++ b/src/recipe/ware/Docker-Hub.c @@ -151,7 +151,9 @@ wr_dockerhub_setsrc (char *option) chsrc_note2 ("选择“Docker Engine”选项卡,在该选项卡中找到“registry-mirrors”一栏,添加镜像地址:"); puts (source.url); } - chsrc_conclude (&source, SetsrcType_Manual); + + ProgMode_ChgType = ChgType_Manual; + chsrc_conclude (&source); } diff --git a/src/recipe/ware/Emacs.c b/src/recipe/ware/Emacs.c index b9abd25..8f64485 100644 --- a/src/recipe/ware/Emacs.c +++ b/src/recipe/ware/Emacs.c @@ -36,9 +36,10 @@ wr_emacs_setsrc (char *option) chsrc_yield_source_and_confirm (wr_emacs); chsrc_note2 ("Emacs换源涉及Elisp,需要手动查阅并换源:"); - puts (source.url); + say (source.url); - chsrc_conclude (&source, SetsrcType_Manual); + ProgMode_ChgType = ChgType_Manual; + chsrc_conclude (&source); } def_target_s (wr_emacs); diff --git a/src/recipe/ware/Flathub.c b/src/recipe/ware/Flathub.c index cfee9f4..0e85309 100644 --- a/src/recipe/ware/Flathub.c +++ b/src/recipe/ware/Flathub.c @@ -37,7 +37,8 @@ wr_flathub_setsrc (char *option) char *cmd = xy_2strjoin ("flatpak remote-modify flathub --url=", source.url); chsrc_run (cmd, RunOpt_Default); - chsrc_conclude (&source, SetsrcType_Auto); + ProgMode_ChgType = ChgType_Auto; + chsrc_conclude (&source); } def_target_s (wr_flathub); diff --git a/src/recipe/ware/Guix.c b/src/recipe/ware/Guix.c index 8fdc4b7..c221693 100644 --- a/src/recipe/ware/Guix.c +++ b/src/recipe/ware/Guix.c @@ -32,8 +32,10 @@ wr_guix_setsrc (char *option) " (url \"", source.url, "\")))"); chsrc_note2 ("为防止扰乱配置文件,请您手动写入以下内容到 ~/.config/guix/channels.scm 文件中"); - puts (file); - chsrc_conclude (&source, SetsrcType_Manual); + say (file); + + ProgMode_ChgType = ChgType_Manual; + chsrc_conclude (&source); } def_target_s (wr_guix); diff --git a/src/recipe/ware/Homebrew.c b/src/recipe/ware/Homebrew.c index 41230b6..1c88faf 100644 --- a/src/recipe/ware/Homebrew.c +++ b/src/recipe/ware/Homebrew.c @@ -81,7 +81,8 @@ wr_homebrew_setsrc (char *option) chsrc_append_to_file (w, fishrc); } - chsrc_conclude(&source, SetsrcType_Auto); + ProgMode_ChgType = ChgType_Auto; + chsrc_conclude (&source); chsrc_note2 ("请您重启终端使Homebrew环境变量生效"); } diff --git a/src/recipe/ware/Nix.c b/src/recipe/ware/Nix.c index a4e1c3a..f52a960 100644 --- a/src/recipe/ware/Nix.c +++ b/src/recipe/ware/Nix.c @@ -56,7 +56,8 @@ wr_nix_setsrc (char *option) chsrc_note2 ("若您使用的是NixOS,请额外添加下述内容至 configuration.nix 中"); say (cmd); - chsrc_conclude (&source, SetsrcType_SemiAuto); + ProgMode_ChgType = ChgType_SemiAuto; + chsrc_conclude (&source); } def_target_s (wr_nix); diff --git a/src/recipe/ware/TeX-Live.c b/src/recipe/ware/TeX-Live.c index 28cca26..083d0f1 100644 --- a/src/recipe/ware/TeX-Live.c +++ b/src/recipe/ware/TeX-Live.c @@ -78,7 +78,8 @@ wr_tex_setsrc (char *option) chsrc_run (cmd, RunOpt_Default); } - chsrc_conclude (&source, SetsrcType_Untested); + ProgMode_ChgType = ChgType_Untested; + chsrc_conclude (&source); } def_target(wr_tex); diff --git a/src/recipe/ware/WinGet.c b/src/recipe/ware/WinGet.c index 305a2cf..445a660 100644 --- a/src/recipe/ware/WinGet.c +++ b/src/recipe/ware/WinGet.c @@ -34,14 +34,17 @@ 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); - chsrc_conclude (&source, SetsrcType_Auto); + ProgMode_ChgType = ChgType_Auto; + chsrc_conclude (&source); } void wr_winget_resetsrc (char *option) { chsrc_run ("winget source reset winget", RunOpt_Default); - chsrc_conclude (NULL, SetsrcType_Auto); + + ProgMode_ChgType = ChgType_Auto; + chsrc_conclude (NULL); }