diff --git a/src/context.rs b/src/context.rs index 8ee9ea78..8f9493e1 100644 --- a/src/context.rs +++ b/src/context.rs @@ -278,7 +278,7 @@ impl<'a> Context<'a> { "bash" => Shell::Bash, "fish" => Shell::Fish, "ion" => Shell::Ion, - "powershell" => Shell::PowerShell, + "powershell" | "pwsh" => Shell::PowerShell, "zsh" => Shell::Zsh, "elvish" => Shell::Elvish, "tcsh" => Shell::Tcsh, diff --git a/src/init/starship.ps1 b/src/init/starship.ps1 index 2ae5158b..d756476e 100755 --- a/src/init/starship.ps1 +++ b/src/init/starship.ps1 @@ -135,7 +135,11 @@ $null = New-Module starship { # Disable virtualenv prompt, it breaks starship $ENV:VIRTUAL_ENV_DISABLE_PROMPT=1 - $ENV:STARSHIP_SHELL = "powershell" + if ($PSVersionTable.PSVersion.Major -gt 5) { + $ENV:STARSHIP_SHELL = "pwsh" + } else { + $ENV:STARSHIP_SHELL = "powershell" + } # Set up the session key that will be used to store logs $ENV:STARSHIP_SESSION_KEY = -join ((48..57) + (65..90) + (97..122) | Get-Random -Count 16 | ForEach-Object { [char]$_ })