diff --git a/scripts/Common/Config/Oh My Posh/install.ps1 b/scripts/Common/Config/Oh My Posh/install.ps1 new file mode 100644 index 00000000..d753061f --- /dev/null +++ b/scripts/Common/Config/Oh My Posh/install.ps1 @@ -0,0 +1,12 @@ +#!/bin/pwsh +. "$PSScriptRoot/../powershell/lib.ps1"; + +Add-PowerShellProfileStatement ` + -Category "oh-my-posh" ` + -Statement $( + @( + "# Oh My Posh!", + $(Get-ScriptInitializer "oh-my-posh init pwsh"), + $(Get-ScriptInitializer "oh-my-posh completion powershell") + ) -join [System.Environment]::NewLine + ) diff --git a/scripts/Windows/Config/Oh My Posh/Install.ps1 b/scripts/Windows/Config/Oh My Posh/Install.ps1 deleted file mode 100644 index 6b820b7a..00000000 --- a/scripts/Windows/Config/Oh My Posh/Install.ps1 +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/pwsh -param($context) -. "$PSScriptRoot/../../Scripts/Context.ps1"; - -[Context] $context = $context; -Write-Host "Configuring Oh My Posh!"; - -$createInvokation = { - param($initializer) - return ". ([scriptblock]::Create(($initializer) -join `"``n`"))"; -} - -$context.AddPowerShellProfileStatement( - "999_Oh My Posh", - [string[]]@( - $createInvokation.Invoke("oh-my-posh init pwsh"), - $createInvokation.Invoke("oh-my-posh completion powershell")) -join [System.Environment]::NewLine); diff --git a/scripts/Windows/Software/Oh My Posh/Install.ps1 b/scripts/Windows/Software/Oh My Posh/Install.ps1 index 268a4db5..e85a482f 100644 --- a/scripts/Windows/Software/Oh My Posh/Install.ps1 +++ b/scripts/Windows/Software/Oh My Posh/Install.ps1 @@ -4,4 +4,4 @@ param($context); [Context] $context = $context; winget install --accept-source-agreements --accept-package-agreements -s winget --scope machine -e --id JanDeDobbeleer.OhMyPosh; -. "$PSScriptRoot/../../Config/Oh My Posh/Install.ps1" $context; +. "$PSScriptRoot/../../../Common/Config/Oh My Posh/install.ps1";