refactor(pwsh): postfix invoke-expression

relates to #708
This commit is contained in:
Jan De Dobbeleer 2021-05-18 20:41:39 +02:00 committed by Jan De Dobbeleer
parent 30bccb06d2
commit 4a16c3fc6c
4 changed files with 4 additions and 4 deletions

View file

@ -21,7 +21,7 @@ Export-PoshTheme -FilePath ~/.mytheme.omp.json -Format json
Once you're done editing, adjust your `$PROFILE` to use your newly created theme.
```powershell
Invoke-Expression (oh-my-posh --init --shell pwsh --config ~/.mytheme.omp.json)
oh-my-posh --init --shell pwsh --config ~/.mytheme.omp.json | Invoke-Expression
```
</TabItem>

View file

@ -26,7 +26,7 @@ oh-my-posh --print-shell
Edit `$PROFILE` in your preferred PowerShell version and add the following line.
```powershell
Invoke-Expression (oh-my-posh --init --shell pwsh --config ~/.mytheme.omp.json)
oh-my-posh --init --shell pwsh --config ~/.mytheme.omp.json | Invoke-Expression
```
Once added, reload your profile for the changes to take effect.

View file

@ -66,7 +66,7 @@ function Set-PoshPrompt {
$global:omp_global_sessionstate = $PSCmdlet.SessionState
$poshCommand = Get-PoshCommand
Invoke-Expression (& $poshCommand --init --shell=pwsh --config="$config")
(& $poshCommand --init --shell=pwsh --config="$config") | Invoke-Expression
}
function Get-PoshThemes {

View file

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