From e638133021702ef1841ff9e24eed72a326a570aa Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Wed, 7 Aug 2024 23:22:04 +0200 Subject: [PATCH] Add a script for installing `Oh My Posh` --- scripts/Common/Software/Oh My Posh/Manage.ps1 | 28 +++++++++++++++++++ scripts/Windows/OS/Install.ps1 | 1 + .../Windows/Software/Oh My Posh/Manage.ps1 | 21 ++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 scripts/Common/Software/Oh My Posh/Manage.ps1 create mode 100644 scripts/Windows/Software/Oh My Posh/Manage.ps1 diff --git a/scripts/Common/Software/Oh My Posh/Manage.ps1 b/scripts/Common/Software/Oh My Posh/Manage.ps1 new file mode 100644 index 00000000..f7457cb7 --- /dev/null +++ b/scripts/Common/Software/Oh My Posh/Manage.ps1 @@ -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) + }; diff --git a/scripts/Windows/OS/Install.ps1 b/scripts/Windows/OS/Install.ps1 index 80d97754..aae58708 100644 --- a/scripts/Windows/OS/Install.ps1 +++ b/scripts/Windows/OS/Install.ps1 @@ -187,6 +187,7 @@ $null = New-Module { . "$softwarePath/chocolatey/Manage.ps1" @arguments; . "$commonSoftware/posh-git/Manage.ps1" @arguments; . "$commonSoftware/Terminal-Icons/Manage.ps1" @arguments; + . "$commonSoftware/Oh My Posh/Manage.ps1" @arguments; } if (Test-Collection "common") { diff --git a/scripts/Windows/Software/Oh My Posh/Manage.ps1 b/scripts/Windows/Software/Oh My Posh/Manage.ps1 new file mode 100644 index 00000000..74069eec --- /dev/null +++ b/scripts/Windows/Software/Oh My Posh/Manage.ps1 @@ -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); + };