Refactor the Oh My Posh profile

This commit is contained in:
Manuel Thalmann 2023-07-27 13:09:30 +02:00
parent 65a44675b2
commit d4e2b633d5

View file

@ -5,8 +5,13 @@ param($context)
[Context] $context = $context;
Write-Host "Configuring Oh My Posh!";
$createInvokation = {
param($initializer)
return "& ([scriptblock]::Create(($initializer) -join `"``n`"))";
}
$context.AddPowerShellProfileStatement(
"999_Oh My Posh",
@(
'oh-my-posh init pwsh | Invoke-Expression;',
"oh-my-posh completion powershell | Invoke-Expression;") -join [System.Environment]::NewLine);
$createInvokation.Invoke("oh-my-posh init pwsh"),
$createInvokation.Invoke("oh-my-posh completion powershell")) -join [System.Environment]::NewLine);