Add a script for installing Oh My Posh

This commit is contained in:
Manuel Thalmann 2024-08-07 23:22:04 +02:00
parent 7fed854044
commit 1be771628b
3 changed files with 50 additions and 0 deletions

View file

@ -0,0 +1,28 @@
param (
$Action,
[hashtable] $Arguments
)
. "$PSScriptRoot/../PowerShell/Profile.ps1";
. "$PSScriptRoot/../../Scripts/Software.ps1";
. "$PSScriptRoot/../../Types/InstallerAction.ps1";
Start-SoftwareInstaller @PSBoundParameters `
-Installer {
param(
[scriptblock] $Installer
)
& $Installer -Action ([InstallerAction]::Configure);
} `
-Configurator {
Add-PowerShellProfileStatement `
-System `
-Category "oh-my-posh" `
-Script (
@(
"# Oh My Posh!",
(Get-ScriptInitializer "oh-my-posh init pwsh"),
(Get-ScriptInitializer "oh-my-posh completion powershell")
) -join [System.Environment]::NewLine)
};

View file

@ -188,6 +188,7 @@ $null = New-Module {
. "$softwarePath/chocolatey/Manage.ps1" @arguments; . "$softwarePath/chocolatey/Manage.ps1" @arguments;
. "$commonSoftware/posh-git/Manage.ps1" @arguments; . "$commonSoftware/posh-git/Manage.ps1" @arguments;
. "$commonSoftware/Terminal-Icons/Manage.ps1" @arguments; . "$commonSoftware/Terminal-Icons/Manage.ps1" @arguments;
. "$commonSoftware/Oh My Posh/Manage.ps1" @arguments;
} }
if (Test-Collection "common") { if (Test-Collection "common") {

View file

@ -0,0 +1,21 @@
param (
$Action,
[hashtable] $Arguments
)
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
. "$PSScriptRoot/../../../Common/Types/InstallerAction.ps1";
Start-SoftwareInstaller @PSBoundParameters `
-Installer {
param(
[scriptblock] $Installer
)
Install-WingetPackage JanDeDobbeleer.OhMyPosh;
& $Installer -Action ([InstallerAction]::Configure);
} `
-Configurator {
. "$PSScriptRoot/../../../Common/Software/Oh My Posh/Manage.ps1" `
-Action ([InstallerAction]::Configure);
};