Skip to content

Commit

Permalink
Support Homebrew for fish shell (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
Word2VecT authored Sep 5, 2024
1 parent 16e7007 commit bf666fa
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions src/recipe/ware/Homebrew.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,31 @@ wr_homebrew_setsrc (char *option)
char *bashrc = "~/.bashrc";
if (xy_file_exist (bashrc))
{
chsrc_backup ("~/.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_conclude (&source, ChsrcTypeAuto);
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"), "\"");

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_conclude(&source, ChsrcTypeAuto);
chsrc_note2 ("请您重启终端使Homebrew环境变量生效");
}

Expand Down

0 comments on commit bf666fa

Please sign in to comment.