mirror of
https://github.com/RubyMetric/chsrc
synced 2025-12-28 13:49:49 +08:00
@@ -48,45 +48,36 @@ wr_homebrew_setsrc (char *option)
|
||||
{
|
||||
chsrc_yield_source_and_confirm (wr_homebrew);
|
||||
|
||||
char *splitter = "\n\n# Generated by chsrc " Chsrc_Banner_Version;
|
||||
char *api_domain = xy_strjoin (3, "export HOMEBREW_API_DOMAIN=\"", xy_2strjoin (source.url, "homebrew-bottles/api"), "\"");
|
||||
char *bottle_domain = xy_strjoin (3, "export HOMEBREW_BOTTLE_DOMAIN=\"", xy_2strjoin (source.url, "homebrew-bottles"), "\"");
|
||||
char *brew_git_remote = xy_strjoin (3, "export HOMEBREW_BREW_GIT_REMOTE=\"", xy_2strjoin (source.url, "git/homebrew/brew.git"), "\"");
|
||||
char *core_git_remote = xy_strjoin (3, "export HOMEBREW_CORE_GIT_REMOTE=\"", xy_2strjoin (source.url, "git/homebrew/homebrew-core.git"), "\"");
|
||||
char *splitter = "\n\n# Generated by chsrc " Chsrc_Banner_Version;
|
||||
char *w1 = xy_strjoin (3, "export HOMEBREW_API_DOMAIN=\"", source.url, "homebrew-bottles/api", "\"\n");
|
||||
char *w2 = xy_strjoin (3, "export HOMEBREW_BOTTLE_DOMAIN=\"", source.url, "homebrew-bottles", "\"\n");
|
||||
char *w3 = xy_strjoin (3, "export HOMEBREW_BREW_GIT_REMOTE=\"", source.url, "git/homebrew/brew.git", "\"\n");
|
||||
char *w4 = xy_strjoin (3, "export HOMEBREW_CORE_GIT_REMOTE=\"", source.url, "git/homebrew/homebrew-core.git", "\"\n");
|
||||
|
||||
char *w = xy_strjoin (5, splitter, w1, w2, w3, w4);
|
||||
|
||||
char *zshrc = "~/.zshrc";
|
||||
chsrc_backup (zshrc);
|
||||
chsrc_append_to_file (splitter, zshrc);
|
||||
chsrc_append_to_file (api_domain, zshrc);
|
||||
chsrc_append_to_file (bottle_domain, zshrc);
|
||||
chsrc_append_to_file (brew_git_remote, zshrc);
|
||||
chsrc_append_to_file (core_git_remote, zshrc);
|
||||
chsrc_append_to_file (w, zshrc);
|
||||
|
||||
char *bashrc = "~/.bashrc";
|
||||
if (xy_file_exist (bashrc))
|
||||
{
|
||||
chsrc_backup (bashrc);
|
||||
chsrc_append_to_file (splitter, bashrc);
|
||||
chsrc_append_to_file (api_domain, bashrc);
|
||||
chsrc_append_to_file (bottle_domain, bashrc);
|
||||
chsrc_append_to_file (brew_git_remote, bashrc);
|
||||
chsrc_append_to_file (core_git_remote, bashrc);
|
||||
chsrc_append_to_file (w, bashrc);
|
||||
}
|
||||
|
||||
char *fishrc = "~/.config/fish/config.fish";
|
||||
if (xy_file_exist (fishrc))
|
||||
{
|
||||
char *api_domain_fish = xy_strjoin(3, "set -x HOMEBREW_API_DOMAIN \"", xy_2strjoin(source.url, "homebrew-bottles/api"), "\"");
|
||||
char *bottle_domain_fish = xy_strjoin(3, "set -x HOMEBREW_BOTTLE_DOMAIN \"", xy_2strjoin(source.url, "homebrew-bottles"), "\"");
|
||||
char *brew_git_remote_fish = xy_strjoin(3, "set -x HOMEBREW_BREW_GIT_REMOTE \"", xy_2strjoin(source.url, "git/homebrew/brew.git"), "\"");
|
||||
char *core_git_remote_fish = xy_strjoin(3, "set -x HOMEBREW_CORE_GIT_REMOTE \"", xy_2strjoin(source.url, "git/homebrew/homebrew-core.git"), "\"");
|
||||
char *w1 = xy_strjoin(3, "set -x HOMEBREW_API_DOMAIN \"", source.url, "homebrew-bottles/api", "\"\n");
|
||||
char *w2 = xy_strjoin(3, "set -x HOMEBREW_BOTTLE_DOMAIN \"", source.url, "homebrew-bottles", "\"\n");
|
||||
char *w3 = xy_strjoin(3, "set -x HOMEBREW_BREW_GIT_REMOTE \"",source.url, "git/homebrew/brew.git", "\"\n");
|
||||
char *w4 = xy_strjoin(3, "set -x HOMEBREW_CORE_GIT_REMOTE \"",source.url, "git/homebrew/homebrew-core.git", "\"\n");
|
||||
|
||||
char *w = xy_strjoin (5, splitter, w1, w2, w3, w4);
|
||||
chsrc_backup (fishrc);
|
||||
chsrc_append_to_file (splitter, fishrc);
|
||||
chsrc_append_to_file (api_domain_fish, fishrc);
|
||||
chsrc_append_to_file (bottle_domain_fish, fishrc);
|
||||
chsrc_append_to_file (brew_git_remote_fish, fishrc);
|
||||
chsrc_append_to_file (core_git_remote_fish, fishrc);
|
||||
chsrc_append_to_file (w, fishrc);
|
||||
}
|
||||
|
||||
chsrc_conclude(&source, SetsrcType_Auto);
|
||||
|
||||
Reference in New Issue
Block a user