Austin Ziegler 8719946036
Allow brew shellenv to accept a shell name param
Resolves #15358

With this change, `brew shellenv` will accept a shell name parameter to
override its default output (based on `/bin/ps`) for advanced use cases
such as with dotfile templating and caching with
[twpayne/chezmoi](https://github.com/twpayne/chezmoi/discussions/2971).
When running under `fish`, this is the output:

```console
$ brew shellenv pwsh
[System.Environment]::SetEnvironmentVariable('HOMEBREW_PREFIX','/opt/homebrew',[System.EnvironmentVariableTarget]::Process)
[System.Environment]::SetEnvironmentVariable('HOMEBREW_CELLAR','/opt/homebrew/Cellar',[System.EnvironmentVariableTarget]::Process)
[System.Environment]::SetEnvironmentVariable('HOMEBREW_REPOSITORY','/opt/homebrew',[System.EnvironmentVariableTarget]::Process)
[System.Environment]::SetEnvironmentVariable('PATH',$('/opt/homebrew/bin:/opt/homebrew/sbin:'+$ENV:PATH),[System.EnvironmentVariableTarget]::Process)
[System.Environment]::SetEnvironmentVariable('MANPATH',$('/opt/homebrew/share/man'+$(if(${ENV:MANPATH}){':'+${ENV:MANPATH}})+':'),[System.EnvironmentVariableTarget]::Process)
[System.Environment]::SetEnvironmentVariable('INFOPATH',$('/opt/homebrew/share/info'+$(if(${ENV:INFOPATH}){':'+${ENV:INFOPATH}})),[System.EnvironmentVariableTarget]::Process)
$ brew shellenv
set -gx HOMEBREW_PREFIX "/opt/homebrew";
set -gx HOMEBREW_CELLAR "/opt/homebrew/Cellar";
set -gx HOMEBREW_REPOSITORY "/opt/homebrew";
set -q PATH; or set PATH ''; set -gx PATH "/opt/homebrew/bin" "/opt/homebrew/sbin" $PATH;
set -q MANPATH; or set MANPATH ''; set -gx MANPATH "/opt/homebrew/share/man" $MANPATH;
set -q INFOPATH; or set INFOPATH ''; set -gx INFOPATH "/opt/homebrew/share/info" $INFOPATH;
```

The specific case presented in the mentioned discussion could be
mitigated by an additional level of indirection (`{{ output "fish" "-c"
"'brew shellenv'" | trim }}`), that requires that the running system
have the target shells installed, when they are not strictly necessary
with `brew shellenv`.
2023-05-05 11:50:48 -04:00
..
2023-04-24 20:42:39 -07:00
2023-04-24 20:42:39 -07:00
2023-04-24 20:42:39 -07:00
2023-04-24 20:42:39 -07:00
2023-04-24 20:42:39 -07:00
2023-04-24 20:42:39 -07:00
2023-04-24 20:42:39 -07:00
2023-04-24 20:42:39 -07:00
2023-04-24 20:42:39 -07:00
2023-04-24 20:42:39 -07:00
2023-04-24 20:42:39 -07:00
2023-04-24 20:42:39 -07:00
2023-04-24 20:42:39 -07:00
2023-04-24 20:42:39 -07:00
2023-04-24 20:42:39 -07:00
2023-04-24 20:42:39 -07:00
2023-04-24 20:42:39 -07:00
2023-04-24 20:42:39 -07:00
2023-04-24 20:42:39 -07:00
2023-04-24 20:42:39 -07:00
2023-04-24 20:42:39 -07:00
2023-04-24 20:42:39 -07:00
2023-04-25 09:26:24 -07:00
2023-04-24 20:42:39 -07:00
2023-04-24 20:42:39 -07:00
2023-04-24 20:42:39 -07:00
2023-04-24 20:42:39 -07:00
2023-04-24 20:42:39 -07:00
2023-04-24 20:42:39 -07:00
2023-04-24 20:42:39 -07:00
2023-04-24 20:42:39 -07:00
2023-04-24 20:42:39 -07:00
2023-04-24 20:42:39 -07:00
2023-04-24 20:42:39 -07:00
2023-04-24 20:42:39 -07:00
2023-04-24 20:42:39 -07:00
2023-04-24 20:42:39 -07:00
2023-04-24 20:42:39 -07:00
2023-03-22 18:03:47 +08:00
2023-03-27 17:24:32 +01:00
2023-04-24 20:42:39 -07:00
2023-04-24 20:42:39 -07:00
2023-04-11 18:10:37 +01:00