@@ -81,7 +81,7 @@ func bashCompletionLocations() []string {
8181 } else {
8282 locations = append (locations ,
8383 "/data/data/com.termux/files/usr/share/bash-completion/completions" , // termux
84- "/usr/local/share/bash-completion/completions" , // osx
84+ "/usr/local/share/bash-completion/completions" , // osx (Intel)
8585 "/usr/share/bash-completion/completions" , // linux
8686 )
8787 }
@@ -90,8 +90,18 @@ func bashCompletionLocations() []string {
9090 locations = append (locations ,
9191 "/data/data/com.termux/files/etc/bash_completion.d" , // termux
9292 "/etc/bash_completion.d" , // linux
93- "/usr/local/etc/bash_completion.d" , // osx
93+ "/opt/homebrew/etc/bash_completion.d" , // osx (Apple Silicon)
94+ "/usr/local/etc/bash_completion.d" , // osx (Intel)
9495 )
9596
97+ // 6) Homebrew prefix (covers both /usr/local and /opt/homebrew, or custom).
98+ // `brew shellenv` sets HOMEBREW_PREFIX; use it when XDG_DATA_DIRS didn't already cover the share dir.
99+ if prefix , ok := os .LookupEnv ("HOMEBREW_PREFIX" ); ok {
100+ locations = append (locations ,
101+ fmt .Sprintf ("%v/etc/bash_completion.d" , prefix ),
102+ fmt .Sprintf ("%v/share/bash-completion/completions" , prefix ),
103+ )
104+ }
105+
96106 return locations
97107}
0 commit comments