From d2c6737798e11f168eead44a2ccbdd1272b36927 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Tue, 3 Sep 2024 01:16:42 +0200 Subject: [PATCH] Allow testing `winget` packages with specific scope --- scripts/Common/Scripts/Software.ps1 | 2 +- scripts/Common/Scripts/SoftwareManagement.ps1 | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/Common/Scripts/Software.ps1 b/scripts/Common/Scripts/Software.ps1 index b237ba2c..d8c71fe2 100644 --- a/scripts/Common/Scripts/Software.ps1 +++ b/scripts/Common/Scripts/Software.ps1 @@ -68,7 +68,7 @@ $null = New-Module { $Names.AddRange($AdditionalNames); foreach ($name in $Names) { - if ($Force.IsPresent -or -not (Test-WingetPackage $name)) { + if ($Force.IsPresent -or -not (Test-WingetPackage -Name $name @PSBoundParameters)) { winget install ` --accept-source-agreements --accept-package-agreements ` --source winget ` diff --git a/scripts/Common/Scripts/SoftwareManagement.ps1 b/scripts/Common/Scripts/SoftwareManagement.ps1 index 8eaca234..23ad951c 100644 --- a/scripts/Common/Scripts/SoftwareManagement.ps1 +++ b/scripts/Common/Scripts/SoftwareManagement.ps1 @@ -52,10 +52,11 @@ function Test-ChocoPackage { function Test-WingetPackage { [OutputType([bool])] param( - [string] $ID + [string] $Name, + [string[]] $ArgumentList ) - & { $null = winget list --accept-source-agreements -e --id $ID; $?; }; + & { $null = winget list --accept-source-agreements -e --id $Name @ArgumentList; $?; }; } <#