mirror of
https://github.com/RubyMetric/chsrc
synced 2025-12-23 10:59:29 +08:00
Adjust chsrc_conclude()
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* File Authors : Aoran Zeng <ccmywish@qq.com>
|
||||
* Contributors : Nil Null <nil@null.org>
|
||||
* 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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user