From a640da02ae9458d3bbe0769741d7b0a62f271c07 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Wed, 20 Mar 2024 22:56:04 +0100 Subject: [PATCH] Overwrite categorized profile files --- scripts/Common/Config/powershell/lib.ps1 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/Common/Config/powershell/lib.ps1 b/scripts/Common/Config/powershell/lib.ps1 index f395b4b7..40b23bb0 100644 --- a/scripts/Common/Config/powershell/lib.ps1 +++ b/scripts/Common/Config/powershell/lib.ps1 @@ -6,7 +6,7 @@ $null = New-Module { [string]$Category = $null, [Parameter(Position=0, Mandatory=$true)] [string]$Statement, - [switch]$Overwrite = $false + [switch]$Overwrite ) [System.Collections.Generic.List[string]] $shells = @(); @@ -29,6 +29,10 @@ $null = New-Module { $profiles = $profiles | ForEach-Object { [System.IO.Path]::GetRelativePath($(Get-Location), $_); }; if ($Category) { + if (-not $($Overwrite.IsPresent)) { + $Overwrite = $true; + } + $profiles = $profiles | ForEach-Object { Join-Path (Split-Path -Parent $_) "profile.d" "$Category.ps1"; }; }