fix(pwsh): allow powershell 5 init

This commit is contained in:
Jan De Dobbeleer 2021-12-01 19:25:05 +01:00 committed by Jan De Dobbeleer
parent 7fae781fff
commit 06258dc256

View file

@ -288,8 +288,8 @@ func initShell(shell, configFile string) string {
return noExe return noExe
} }
switch shell { switch shell {
case pwsh: case pwsh, powershell5:
return fmt.Sprintf("(@(&\"%s\" --print-init --shell=pwsh --config=\"%s\") -join \"`n\") | Invoke-Expression", executable, configFile) return fmt.Sprintf("(@(&\"%s\" --print-init --shell=%s --config=\"%s\") -join \"`n\") | Invoke-Expression", executable, shell, configFile)
case zsh, bash, fish, winCMD: case zsh, bash, fish, winCMD:
return printShellInit(shell, configFile) return printShellInit(shell, configFile)
default: default:
@ -303,7 +303,7 @@ func printShellInit(shell, configFile string) string {
return noExe return noExe
} }
switch shell { switch shell {
case pwsh: case pwsh, powershell5:
return getShellInitScript(executable, configFile, pwshInit) return getShellInitScript(executable, configFile, pwshInit)
case zsh: case zsh:
return getShellInitScript(executable, configFile, zshInit) return getShellInitScript(executable, configFile, zshInit)