2019-01-30 21:31:33 +00:00
#: * `shellenv`
2018-09-13 09:27:43 +01:00
#:
2019-08-20 00:04:14 -04:00
#: Print export statements. When run in a shell, this installation of Homebrew will be added to your `PATH`, `MANPATH`, and `INFOPATH`.
2018-09-13 09:27:43 +01:00
#:
2019-08-20 00:04:14 -04:00
#: The variables `HOMEBREW_PREFIX`, `HOMEBREW_CELLAR` and `HOMEBREW_REPOSITORY` are also exported to avoid querying them multiple times.
2020-05-11 21:26:45 -07:00
#: Consider adding evaluation of this command's output to your dotfiles (e.g. `~/.profile`, `~/.bash_profile`, or `~/.zprofile`) with: `eval $(brew shellenv)`
2018-09-13 09:27:43 +01:00
homebrew-shellenv( ) {
2019-02-20 10:10:31 +00:00
case " $SHELL " in
2020-04-29 08:20:06 +02:00
*/fish| fish)
2019-02-20 10:10:31 +00:00
echo " set -gx HOMEBREW_PREFIX \" $HOMEBREW_PREFIX \"; "
echo " set -gx HOMEBREW_CELLAR \" $HOMEBREW_CELLAR \"; "
echo " set -gx HOMEBREW_REPOSITORY \" $HOMEBREW_REPOSITORY \"; "
2020-03-26 09:38:25 -05:00
echo " set -q PATH; or set PATH ''; set -gx PATH \" $HOMEBREW_PREFIX /bin\" \" $HOMEBREW_PREFIX /sbin\" \$PATH; "
2019-02-21 17:54:29 -08:00
echo " set -q MANPATH; or set MANPATH ''; set -gx MANPATH \" $HOMEBREW_PREFIX /share/man\" \$MANPATH; "
echo " set -q INFOPATH; or set INFOPATH ''; set -gx INFOPATH \" $HOMEBREW_PREFIX /share/info\" \$INFOPATH; "
2019-02-20 10:10:31 +00:00
; ;
2020-04-29 08:20:06 +02:00
*/csh| csh| */tcsh| tcsh)
2019-02-20 10:10:31 +00:00
echo " setenv HOMEBREW_PREFIX $HOMEBREW_PREFIX ; "
echo " setenv HOMEBREW_CELLAR $HOMEBREW_CELLAR ; "
echo " setenv HOMEBREW_REPOSITORY $HOMEBREW_REPOSITORY ; "
echo " setenv PATH $HOMEBREW_PREFIX /bin: $HOMEBREW_PREFIX /sbin:\$PATH; "
2020-05-25 10:11:05 -07:00
echo " setenv MANPATH $HOMEBREW_PREFIX /share/man\`[ \${?MANPATH} == 1 ] && echo \":\${MANPATH}\"\`:; "
echo " setenv INFOPATH $HOMEBREW_PREFIX /share/info\`[ \${?INFOPATH} == 1 ] && echo \":\${INFOPATH}\"\`; "
2019-02-20 10:10:31 +00:00
; ;
*)
2019-08-20 12:54:44 -04:00
echo " export HOMEBREW_PREFIX=\" $HOMEBREW_PREFIX \"; "
echo " export HOMEBREW_CELLAR=\" $HOMEBREW_CELLAR \"; "
echo " export HOMEBREW_REPOSITORY=\" $HOMEBREW_REPOSITORY \"; "
2019-10-17 20:14:01 +02:00
echo " export PATH=\" $HOMEBREW_PREFIX /bin: $HOMEBREW_PREFIX /sbin\${PATH+:\$PATH}\"; "
2019-10-31 12:25:58 +00:00
echo " export MANPATH=\" $HOMEBREW_PREFIX /share/man\${MANPATH+:\$MANPATH}:\"; "
append colon (:) to end of brew's part of INFOPATH in brew shellenv
The behavior of some programs (e.g., emacs) differs depending on
whether INFOPATH is terminated in a colon or not. For example, the
info viewer built into emacs has a default list of places from which
it will draw info files, and it will only check this if either (a)
INFOPATH is unset, or (b) INFOPATH ends in a colon.
Currently brew shellenv prepends to the existing $INFOPATH and will
separate with a colon if $INFOPATH already exists, but if it does not
it will not terminate in a colon. As a result, info
pages (like emacs and elisp) are missing from the info viewer.
The existing brew shellenv logic used a parameter expansion trick to
include a colon only if it was prepending to an extant INFOPATH, but
because we want brew's contribution to the INFOPATH to always end in a
colon (whether there's an existing INFOPATH or not), we don't have to
use the parameter expansion trick
This commit only changes behavior for "other" shells (i.e., not fish,
csh, or tcsh) since I don't know how to append a colon to variables in
these shells.
2020-06-12 15:04:22 -04:00
echo " export INFOPATH=\" $HOMEBREW_PREFIX /share/info:\${INFOPATH}\"; "
2019-02-20 10:10:31 +00:00
; ;
esac
2018-09-13 09:27:43 +01:00
}