PowerShell_Scripts/shell-loading-snippets/zsh

36 lines
1.4 KiB
Plaintext
Raw Normal View History

echo "$(date) SZ_SKIP_DEFAULT_SHELL='$SZ_SKIP_DEFAULT_SHELL'; snippet/zsh" >> /tmp/default_shell
## Place the following line at the top of your .zshrc to make powershell your default shell.
## __P=".local/share/powershell/Scripts/shell-loading-snippets/$(basename $SHELL)"; find ~/$__P -exec true \; && . ~/$__P
function PowerShellLauncher() {
export SZ_POWERSHELL_LAUNCER_CALLED=1
[[ $- != *i* ]] && return
if [[ -x ~/.dotnet/tools/pwsh && "1" != "$(which pwsh > /dev/null && echo 1)" ]]; then
PWSH='~/.dotnet/tools/pwsh'
alias pwsh="$PWSH "
export DOTNET_CLI_TELEMETRY_OPTOUT=1
fi
echo "$(date) SZ_SKIP_DEFAULT_SHELL='$SZ_SKIP_DEFAULT_SHELL'; pwsh: $(which pwsh); Setup-ScriptEnv: $(ls ~/.local/share/powershell/Scripts/Setup-ScriptEnv.ps1) " >> /tmp/default_shell
if [[ "$SZ_SKIP_DEFAULT_SHELL" != "1" ]]; then
export SZ_SKIP_DEFAULT_SHELL=1
if [[ "1" == "$(which pwsh > /dev/null && echo 1)" && -f ~/.local/share/powershell/Scripts/Setup-ScriptEnv.ps1 ]]; then
echo 'Starting PowerShell SZcripts...'
echo "pwsh" >> /tmp/default_shell
pwsh
if [[ ! -f /tmp/keep_shell_after_pwsh ]]; then
exit
fi
fi
fi
echo "continue" >> /tmp/default_shell
export SZ_SKIP_DEFAULT_SHELL=1
}
[[ "$SZ_POWERSHELL_LAUNCER_CALLED" != "1" ]] && PowerShellLauncher