ed94e06dda36d2e321e11001b4d0f6db940e9ee9

Author
Hielke Walinga <hielkewalinga@gmail.com>
Committer
GitHub <noreply@github.com>
Date

Message

command-not-found: speed up call to Homebrew command-not-found (#7740)

By sourcing brew files directly we can achieve a very high speed up.
This will not work if the user installed homebrew in a different
location than by default.

Diff

 1diff --git a/plugins/command-not-found/command-not-found.plugin.zsh b/plugins/command-not-found/command-not-found.plugin.zsh
 2index dd1186e443c25fb9ddedba292180dfa80d666421..81d76e6386a50c17dfa161f441cd8b1221329522 100644
 3--- a/plugins/command-not-found/command-not-found.plugin.zsh
 4+++ b/plugins/command-not-found/command-not-found.plugin.zsh
 5@@ -26,10 +26,8 @@ fi
 6 
 7 # OSX command-not-found support
 8 # https://github.com/Homebrew/homebrew-command-not-found
 9-if type brew &> /dev/null; then
10-  if brew command command-not-found-init > /dev/null 2>&1; then
11-    eval "$(brew command-not-found-init)";
12-  fi
13+if [[ -s '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-command-not-found/handler.sh' ]]; then
14+    source '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-command-not-found/handler.sh'
15 fi
16 
17 # NixOS command-not-found support