Rename inner function

This commit is contained in:
Aoran Zeng
2024-08-18 09:27:22 +08:00
parent 15d9ba817e
commit eba633b6e4
55 changed files with 123 additions and 231 deletions

View File

@@ -25,9 +25,7 @@ def_sources_n(wr_anaconda);
void
wr_anaconda_setsrc (char *option)
{
SourceInfo source;
chsrc_yield_source (wr_anaconda);
chsrc_confirm_source (&source);
chsrc_yield_source_and_confirm (wr_anaconda);
char *main = xy_2strjoin (source.url, "pkgs/main");
char *r = xy_2strjoin (source.url, "pkgs/r");
@@ -69,7 +67,7 @@ wr_anaconda_setsrc (char *option)
puts (file);
chsrc_note2 ("然后运行 conda clean -i 清除索引缓存,保证用的是镜像站提供的索引");
chsrc_say_lastly (&source, ChsrcTypeSemiAuto);
chsrc_conclude (&source, ChsrcTypeSemiAuto);
}
def_target_s (wr_anaconda);

View File

@@ -24,9 +24,7 @@ def_sources_n(wr_cocoapods);
void
wr_cocoapods_setsrc (char *option)
{
SourceInfo source;
chsrc_yield_source (wr_cocoapods);
chsrc_confirm_source (&source);
chsrc_yield_source_and_confirm (wr_cocoapods);
chsrc_note2 ("请手动执行以下命令:");
@@ -40,7 +38,7 @@ wr_cocoapods_setsrc (char *option)
char *source_str = xy_strjoin (3, "source '", source.url, "'");
say (source_str);
chsrc_say_lastly (&source, ChsrcTypeManual);
chsrc_conclude (&source, ChsrcTypeManual);
}
def_target_s (wr_cocoapods);

View File

@@ -66,9 +66,7 @@ wr_dockerhub_getsrc (char *option)
void
wr_dockerhub_setsrc (char *option)
{
SourceInfo source;
chsrc_yield_source (wr_dockerhub);
chsrc_confirm_source (&source);
chsrc_yield_source_and_confirm (wr_dockerhub);
if (xy_on_linux || xy_on_bsd)
{
@@ -93,7 +91,7 @@ wr_dockerhub_setsrc (char *option)
chsrc_note2 ("选择“Docker Engine”选项卡在该选项卡中找到“registry-mirrors”一栏添加镜像地址:");
puts (source.url);
}
chsrc_say_lastly (&source, ChsrcTypeManual);
chsrc_conclude (&source, ChsrcTypeManual);
}

View File

@@ -30,14 +30,12 @@ def_sources_n(wr_emacs);
void
wr_emacs_setsrc (char *option)
{
SourceInfo source;
chsrc_yield_source (wr_emacs);
chsrc_confirm_source (&source);
chsrc_yield_source_and_confirm (wr_emacs);
chsrc_note2 ("Emacs换源涉及Elisp需要手动查阅并换源:");
puts (source.url);
chsrc_say_lastly (&source, ChsrcTypeManual);
chsrc_conclude (&source, ChsrcTypeManual);
}
def_target_s (wr_emacs);

View File

@@ -25,9 +25,7 @@ def_sources_n(wr_flathub);
void
wr_flathub_setsrc (char *option)
{
SourceInfo source;
chsrc_yield_source (wr_flathub);
chsrc_confirm_source (&source);
chsrc_yield_source_and_confirm (wr_flathub);
chsrc_note2 ("若出现问题,可先调用以下命令:");
char *note = xy_strjoin (3,
@@ -39,7 +37,7 @@ wr_flathub_setsrc (char *option)
char *cmd = xy_2strjoin ("flatpak remote-modify flathub --url=", source.url);
chsrc_run (cmd, RunOpt_Default);
chsrc_say_lastly (&source, ChsrcTypeAuto);
chsrc_conclude (&source, ChsrcTypeAuto);
}
def_target_s (wr_flathub);

View File

@@ -25,9 +25,7 @@ def_sources_n(wr_guix);
void
wr_guix_setsrc (char *option)
{
SourceInfo source;
chsrc_yield_source (wr_guix);
chsrc_confirm_source (&source);
chsrc_yield_source_and_confirm (wr_guix);
char *file = xy_strjoin (3, "(list (channel\n"
" (inherit (car %default-channels))\n"
@@ -35,7 +33,7 @@ wr_guix_setsrc (char *option)
chsrc_note2 ("为防止扰乱配置文件,请您手动写入以下内容到 ~/.config/guix/channels.scm 文件中");
puts (file);
chsrc_say_lastly (&source, ChsrcTypeManual);
chsrc_conclude (&source, ChsrcTypeManual);
}
def_target_s (wr_guix);

View File

@@ -45,9 +45,7 @@ wr_homebrew_getsrc (char *option)
void
wr_homebrew_setsrc (char *option)
{
SourceInfo source;
chsrc_yield_source (wr_homebrew);
chsrc_confirm_source (&source);
chsrc_yield_source_and_confirm (wr_homebrew);
char *splitter = "\n\n# Generated by chsrc " Chsrc_Version;
char *api_domain = xy_strjoin (3, "export HOMEBREW_API_DOMAIN=\"", xy_2strjoin (source.url, "homebrew-bottles/api"), "\"");
@@ -74,7 +72,7 @@ wr_homebrew_setsrc (char *option)
chsrc_append_to_file (core_git_remote, bashrc);
}
chsrc_say_lastly (&source, ChsrcTypeAuto);
chsrc_conclude (&source, ChsrcTypeAuto);
chsrc_note2 ("请您重启终端使Homebrew环境变量生效");
}

View File

@@ -38,9 +38,7 @@ wr_nix_setsrc (char *option)
{
wr_nix_check_cmd ();
SourceInfo source;
chsrc_yield_source (wr_nix);
chsrc_confirm_source (&source);
chsrc_yield_source_and_confirm (wr_nix);
char *cmd = xy_strjoin (3, "nix-channel --add ", source.url, "nixpkgs-unstable nixpkgs");
chsrc_run (cmd, RunOpt_Default);
@@ -58,7 +56,7 @@ wr_nix_setsrc (char *option)
chsrc_note2 ("若您使用的是NixOS请额外添加下述内容至 configuration.nix 中");
puts (cmd);
chsrc_say_lastly (&source, ChsrcTypeSemiAuto);
chsrc_conclude (&source, ChsrcTypeSemiAuto);
}
def_target_s (wr_nix);

View File

@@ -61,9 +61,7 @@ wr_tex_setsrc (char *option)
bool tlmgr_exist, mpm_exist;
wr_tex_check_cmd (&tlmgr_exist, &mpm_exist);
SourceInfo source;
chsrc_yield_source (wr_tex);
chsrc_confirm_source (&source);
chsrc_yield_source_and_confirm (wr_tex);
char *cmd = NULL;
@@ -80,7 +78,7 @@ wr_tex_setsrc (char *option)
chsrc_run (cmd, RunOpt_Default);
}
chsrc_say_lastly (&source, ChsrcTypeUntested);
chsrc_conclude (&source, ChsrcTypeUntested);
}
def_target(wr_tex);

View File

@@ -29,21 +29,19 @@ wr_winget_getsrc (char *option)
void
wr_winget_setsrc (char *option)
{
SourceInfo source;
chsrc_yield_source (wr_winget);
chsrc_confirm_source (&source);
chsrc_yield_source_and_confirm (wr_winget);
chsrc_run ("winget source remove winget", RunOpt_Default);
chsrc_run (xy_2strjoin ("winget source add winget ", source.url), RunOpt_Default);
chsrc_say_lastly (&source, ChsrcTypeAuto);
chsrc_conclude (&source, ChsrcTypeAuto);
}
void
wr_winget_resetsrc (char *option)
{
chsrc_run ("winget source reset winget", RunOpt_Default);
chsrc_say_lastly (NULL, ChsrcTypeAuto);
chsrc_conclude (NULL, ChsrcTypeAuto);
}