param ( $Action, [hashtable] $Arguments ) . "$PSScriptRoot/../aliae/Manage.ps1"; . "$PSScriptRoot/../PowerShell/Profile.ps1"; . "$PSScriptRoot/../../Scripts/Software.ps1"; . "$PSScriptRoot/../../Types/InstallerAction.ps1"; Start-SoftwareInstaller @PSBoundParameters ` -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) } ` -UserConfigurator { param( [hashtable] $Arguments ) $theme = Get-UserConfig "oh-my-posh.theme"; function New-Theme { param($info) $root = "$($IsWindows ? $env:AppData : "~/.config")/oh-my-posh"; $path = Join-Path $root "$($info.name).omp.json"; $null = New-Item -Force -ItemType Directory $root; Set-Content $path ( & { if ($IsWindows) { wsl cat $info.source; } else { cat $info.source; } }); return $path; } foreach ($additionalTheme in (Get-UserConfig "oh-my-posh.additionalThemes")) { Write-Host "creating theme $additionalTheme" $null = New-Theme $additionalTheme; } if ($theme) { $varName = "POSH_THEME"; if ($theme -isnot [string]) { $theme = [string](New-Theme $theme); } if ($IsWindows) { [System.Environment]::SetEnvironmentVariable($varName, "%AppData%/$([System.IO.Path]::GetRelativePath($env:AppData, $theme))", "User"); } else { . "$PSScriptRoot/../aliae/Manage.ps1"; Add-EnvironmentVariable -User $Arguments.Name $varName ($theme).Replace("~", "{{ .Home }}"); } } };