mirror of
https://github.com/RubyMetric/chsrc
synced 2026-03-05 13:50:51 +08:00
Rename inner function
This commit is contained in:
@@ -23,13 +23,11 @@ def_sources_n(pl_clojure);
|
||||
void
|
||||
pl_clojure_setsrc (char *option)
|
||||
{
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (pl_clojure);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (pl_clojure);
|
||||
|
||||
chsrc_note2 ("抱歉,Clojure换源较复杂,您可手动查阅并换源:");
|
||||
puts (source.url);
|
||||
chsrc_say_lastly (&source, ChsrcTypeManual);
|
||||
chsrc_conclude (&source, ChsrcTypeManual);
|
||||
}
|
||||
|
||||
def_target_s (pl_clojure);
|
||||
|
||||
@@ -48,9 +48,7 @@ pl_dart_getsrc (char *option)
|
||||
void
|
||||
pl_dart_setsrc (char *option)
|
||||
{
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (pl_dart);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (pl_dart);
|
||||
|
||||
char *towrite = NULL;
|
||||
|
||||
@@ -85,7 +83,7 @@ pl_dart_setsrc (char *option)
|
||||
towrite = xy_strjoin (3, "export FLUTTER_STORAGE_BASE_URL=\"", flutter, "\"");
|
||||
chsrc_append_to_file (towrite, "~/.bashrc >> ~/.zshrc");
|
||||
}
|
||||
chsrc_say_lastly (&source, ChsrcTypeUntested);
|
||||
chsrc_conclude (&source, ChsrcTypeUntested);
|
||||
}
|
||||
|
||||
def_target(pl_dart);
|
||||
|
||||
@@ -59,16 +59,14 @@ pl_go_setsrc (char *option)
|
||||
{
|
||||
pl_go_check_cmd ();
|
||||
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (pl_go);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (pl_go);
|
||||
|
||||
char *cmd = "go env -w GO111MODULE=on";
|
||||
chsrc_run (cmd, RunOpt_Default);
|
||||
|
||||
cmd = xy_strjoin (3, "go env -w GOPROXY=", source.url, ",direct");
|
||||
chsrc_run (cmd, RunOpt_Default);
|
||||
chsrc_say_lastly (&source, ChsrcTypeAuto);
|
||||
chsrc_conclude (&source, ChsrcTypeAuto);
|
||||
}
|
||||
|
||||
def_target(pl_go);
|
||||
|
||||
@@ -24,9 +24,7 @@ def_sources_n(pl_haskell);
|
||||
void
|
||||
pl_haskell_setsrc (char *option)
|
||||
{
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (pl_haskell);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (pl_haskell);
|
||||
|
||||
char *file = xy_strjoin (3, "repository mirror\n"
|
||||
" url: ", source.url,
|
||||
@@ -64,7 +62,7 @@ pl_haskell_setsrc (char *option)
|
||||
|
||||
chsrc_note2 (xy_strjoin (3, "请向 ", config, " 中手动添加:"));
|
||||
puts (file);
|
||||
chsrc_say_lastly (&source, ChsrcTypeManual);
|
||||
chsrc_conclude (&source, ChsrcTypeManual);
|
||||
}
|
||||
|
||||
def_target_s (pl_haskell);
|
||||
|
||||
@@ -63,9 +63,7 @@ pl_java_setsrc (char *option)
|
||||
bool maven_exist, gradle_exist;
|
||||
pl_java_check_cmd (&maven_exist, &gradle_exist);
|
||||
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (pl_java);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (pl_java);
|
||||
|
||||
if (maven_exist)
|
||||
{
|
||||
@@ -97,7 +95,7 @@ pl_java_setsrc (char *option)
|
||||
chsrc_note2 ("请在您的 build.gradle 中添加:");
|
||||
puts (file);
|
||||
}
|
||||
chsrc_say_lastly (&source, ChsrcTypeManual);
|
||||
chsrc_conclude (&source, ChsrcTypeManual);
|
||||
}
|
||||
|
||||
def_target(pl_java);
|
||||
|
||||
@@ -42,14 +42,12 @@ pl_julia_getsrc (char *option)
|
||||
void
|
||||
pl_julia_setsrc (char *option)
|
||||
{
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (pl_julia);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (pl_julia);
|
||||
|
||||
const char *towrite = xy_strjoin (3, "ENV[\"JULIA_PKG_SERVER\"] = \"", source.url, "\"");
|
||||
|
||||
chsrc_append_to_file (towrite, "~/.julia/config/startup.jl");
|
||||
chsrc_say_lastly (&source, ChsrcTypeUntested);
|
||||
chsrc_conclude (&source, ChsrcTypeUntested);
|
||||
}
|
||||
|
||||
def_target(pl_julia);
|
||||
|
||||
@@ -36,9 +36,7 @@ pl_lua_getsrc (char *option)
|
||||
void
|
||||
pl_lua_setsrc (char *option)
|
||||
{
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (pl_lua);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (pl_lua);
|
||||
|
||||
char *config = xy_strjoin (3, "rocks_servers = {\n"
|
||||
" \"", source.url, "\"\n"
|
||||
@@ -53,7 +51,7 @@ pl_lua_setsrc (char *option)
|
||||
chsrc_note2 ("请手动修改 ~/.luarocks/upload_config.lua 文件 (用于上传):");
|
||||
puts (upload_config);
|
||||
|
||||
chsrc_say_lastly (&source, ChsrcTypeManual);
|
||||
chsrc_conclude (&source, ChsrcTypeManual);
|
||||
}
|
||||
|
||||
def_target(pl_lua);
|
||||
|
||||
@@ -79,9 +79,7 @@ pl_nodejs_setsrc (char *option)
|
||||
bool npm_exist, yarn_exist, pnpm_exist;
|
||||
pl_nodejs_check_cmd (&npm_exist, &yarn_exist, &pnpm_exist);
|
||||
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (pl_nodejs);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (pl_nodejs);
|
||||
|
||||
char *cmd = NULL;
|
||||
|
||||
@@ -110,7 +108,7 @@ pl_nodejs_setsrc (char *option)
|
||||
chsrc_run (cmd, RunOpt_Default);
|
||||
}
|
||||
|
||||
chsrc_say_lastly (&source, ChsrcTypeAuto);
|
||||
chsrc_conclude (&source, ChsrcTypeAuto);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -39,9 +39,7 @@ pl_ocaml_setsrc(char *option)
|
||||
{
|
||||
pl_ocaml_check_cmd ();
|
||||
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (pl_ocaml);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (pl_ocaml);
|
||||
|
||||
char *cmd = xy_strjoin (3, "opam repo set-url default ",
|
||||
source.url,
|
||||
@@ -52,7 +50,7 @@ pl_ocaml_setsrc(char *option)
|
||||
chsrc_note2 ("如果是首次使用 opam ,请使用以下命令进行初始化");
|
||||
puts (xy_2strjoin ("opam init default ", source.url));
|
||||
|
||||
chsrc_say_lastly (&source, ChsrcTypeSemiAuto);
|
||||
chsrc_conclude (&source, ChsrcTypeSemiAuto);
|
||||
}
|
||||
|
||||
def_target(pl_ocaml);
|
||||
|
||||
@@ -45,9 +45,7 @@ pl_php_setsrc (char *option)
|
||||
{
|
||||
pl_php_check_cmd ();
|
||||
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (pl_php);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (pl_php);
|
||||
|
||||
char *where = " -g ";
|
||||
if (CliOpt_Locally==true)
|
||||
@@ -58,7 +56,7 @@ pl_php_setsrc (char *option)
|
||||
char *cmd = xy_strjoin (4, "composer config", where, "repo.packagist composer ", source.url);
|
||||
chsrc_run (cmd, RunOpt_Default);
|
||||
|
||||
chsrc_say_lastly (&source, ChsrcTypeSemiAuto);
|
||||
chsrc_conclude (&source, ChsrcTypeSemiAuto);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -47,9 +47,7 @@ pl_perl_getsrc (char *option)
|
||||
void
|
||||
pl_perl_setsrc (char *option)
|
||||
{
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (pl_perl);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (pl_perl);
|
||||
|
||||
char *cmd = xy_strjoin (3,
|
||||
"perl -MCPAN -e \"CPAN::HandleConfig->load(); CPAN::HandleConfig->edit('urllist', 'unshift', '", source.url, "'); CPAN::HandleConfig->commit()\"");
|
||||
@@ -57,7 +55,7 @@ pl_perl_setsrc (char *option)
|
||||
|
||||
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_say_lastly (&source, ChsrcTypeSemiAuto);
|
||||
chsrc_conclude (&source, ChsrcTypeSemiAuto);
|
||||
}
|
||||
|
||||
def_target(pl_perl);
|
||||
|
||||
@@ -107,9 +107,7 @@ pl_python_setsrc (char *option)
|
||||
|
||||
pl_python_check_cmd (&prog, &poetry_exist, &pdm_exist);
|
||||
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (pl_python);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (pl_python);
|
||||
|
||||
// 这里用的是 config --user,会写入用户目录(而不是项目目录)
|
||||
// GitHub#39
|
||||
@@ -133,7 +131,7 @@ pl_python_setsrc (char *option)
|
||||
chsrc_run (cmd, RunOpt_Default);
|
||||
}
|
||||
|
||||
chsrc_say_lastly (&source, chsrc_type);
|
||||
chsrc_conclude (&source, chsrc_type);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -52,9 +52,7 @@ pl_r_getsrc (char *option)
|
||||
void
|
||||
pl_r_setsrc (char *option)
|
||||
{
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (pl_r);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (pl_r);
|
||||
|
||||
char *bioconductor_url = xy_str_delete_suffix (xy_str_delete_suffix (source.url, "cran/"), "CRAN/");
|
||||
bioconductor_url = xy_2strjoin(bioconductor_url, "bioconductor");
|
||||
@@ -73,7 +71,7 @@ pl_r_setsrc (char *option)
|
||||
chsrc_append_to_file (towrite1, "~/.Rprofile");
|
||||
chsrc_append_to_file (towrite2, "~/.Rprofile");
|
||||
}
|
||||
chsrc_say_lastly (&source, ChsrcTypeAuto);
|
||||
chsrc_conclude (&source, ChsrcTypeAuto);
|
||||
}
|
||||
|
||||
def_target(pl_r);
|
||||
|
||||
@@ -68,9 +68,7 @@ pl_ruby_setsrc (char *option)
|
||||
|
||||
chsrc_ensure_program ("gem");
|
||||
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (pl_ruby);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (pl_ruby);
|
||||
|
||||
char *cmd = NULL;
|
||||
|
||||
@@ -91,7 +89,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);
|
||||
|
||||
chsrc_say_lastly (&source, chsrc_type);
|
||||
chsrc_conclude (&source, chsrc_type);
|
||||
|
||||
// chsrc_note2 ("Ruby的镜像源目前仅有 腾讯软件源,RubyChina 实现正确");
|
||||
// chsrc_note2 ("而其它如Tuna,Bfsu,Ali目前都实现的有问题,请勿使用");
|
||||
|
||||
@@ -35,9 +35,7 @@ pl_rust_getsrc (char *option)
|
||||
void
|
||||
pl_rust_setsrc (char *option)
|
||||
{
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (pl_rust);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (pl_rust);
|
||||
|
||||
const char* file = xy_strjoin (3,
|
||||
"[source.crates-io]\n"
|
||||
@@ -48,7 +46,7 @@ pl_rust_setsrc (char *option)
|
||||
|
||||
chsrc_note2 (xy_strjoin (3, "请您手动写入以下内容到 ", xy_uniform_path ("~/.cargo/config.toml"), " 文件中:"));
|
||||
puts (file);
|
||||
chsrc_say_lastly (&source, ChsrcTypeManual);
|
||||
chsrc_conclude (&source, ChsrcTypeManual);
|
||||
}
|
||||
|
||||
def_target(pl_rust);
|
||||
|
||||
Reference in New Issue
Block a user