8b55fb3b60e885934745b03d8fd550c6eaa82121

Author
Daniel Wang <wangyang0123@gmail.com>
Committer
Marc Cornellà <hello@mcornella.com>
Date

Message

feat(command-not-found): add support for Homebrew on Apple M1 (#9797)

Diff

 1diff --git a/plugins/command-not-found/command-not-found.plugin.zsh b/plugins/command-not-found/command-not-found.plugin.zsh
 2index aea1e1b4cde90cb417cd58e6a66a22ffdb7f4d4e..10f3a627709be3a9c40d90c1604e52fbe1b08908 100644
 3--- a/plugins/command-not-found/command-not-found.plugin.zsh
 4+++ b/plugins/command-not-found/command-not-found.plugin.zsh
 5@@ -38,10 +38,13 @@ if [ -f /usr/libexec/pk-command-not-found ]; then
 6     }
 7 fi
 8 
 9-# OSX command-not-found support
10+# macOS command-not-found support
11 # https://github.com/Homebrew/homebrew-command-not-found
12-if [[ -s '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-command-not-found/handler.sh' ]]; then
13-    source '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-command-not-found/handler.sh'
14+HB_CNF_HANDLER_SUFFIX="Library/Taps/homebrew/homebrew-command-not-found/handler.sh"
15+if [[ -s "/opt/homebrew/$HB_CNF_HANDLER_SUFFIX" ]]; then
16+      source "/opt/homebrew/$HB_CNF_HANDLER_SUFFIX"
17+elif [[ -s "/usr/local/Homebrew/$HB_CNF_HANDLER_SUFFIX" ]]; then
18+      source "/usr/local/Homebrew/$HB_CNF_HANDLER_SUFFIX"
19 fi
20 
21 # NixOS command-not-found support