Performance issue with fish shell (#1483)

The fish shell takes a long time to open an instance, this is because an instance of Brew is running to initialize packages when it is certainly not required to activate it, for example, open a simple terminal to edit some file

Co-authored-by: achengli <achengli@github.com>
This commit is contained in:
yassin 2024-08-18 01:45:50 +02:00 committed by Kyle Gospodnetich
parent 1d8a8b31cd
commit d5097a5e97

View File

@ -1,18 +1,32 @@
#!/usr/bin/fish
#shellcheck disable=all
if status --is-interactive
if [ -d /home/linuxbrew/.linuxbrew ]
set -g __brew_instance_initialize 0
set -g __brew_binary /home/linuxbrew/.linuxbrew/bin/brew
function brew_new_instance
alias brew=$__brew_binary
if test $__brew_instance_initialize = 0
if status --is-interactive
if [ -d /home/linuxbrew/.linuxbrew ]
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
if [ -w /home/linuxbrew/.linuxbrew ]
if [ ! -L (brew --prefix)/share/fish/vendor_completions.d/brew ]
brew completions link > /dev/null
end
if [ ! -L (brew --prefix)/share/fish/vendor_completions.d/brew ]
brew completions link > /dev/null
end
end
if test -d (brew --prefix)/share/fish/completions
set -p fish_complete_path (brew --prefix)/share/fish/completions
set -p fish_complete_path (brew --prefix)/share/fish/completions
end
if test -d (brew --prefix)/share/fish/vendor_completions.d
set -p fish_complete_path (brew --prefix)/share/fish/vendor_completions.d
set -p fish_complete_path (brew --prefix)/share/fish/vendor_completions.d
end
end
end
set __brew_instance_initialize 1
brew $argv
end
end
alias brew=brew_new_instance