Create common pwsh installation script

This commit is contained in:
Manuel Thalmann 2024-03-20 21:34:47 +01:00
parent 4c224f411e
commit d0a56afd19
3 changed files with 13 additions and 18 deletions

View file

@ -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
)

View file

@ -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);

View file

@ -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";