Improve winget function

This commit is contained in:
Manuel Thalmann 2024-08-08 04:28:21 +02:00
parent e29e36acf7
commit ddfbe17a49

View file

@ -56,10 +56,16 @@ $null = New-Module {
function Install-WingetPackage { function Install-WingetPackage {
param( param(
[switch] $Force, [switch] $Force,
[Parameter(Position=0)]
[string] $Name,
[Parameter(ValueFromRemainingArguments = $true)] [Parameter(ValueFromRemainingArguments = $true)]
[string[]] $Names [string[]] $AdditionalNames = @()
) )
[System.Collections.ArrayList] $Names = @();
$null = $Names.Add($Name);
$Names.AddRange($AdditionalNames);
foreach ($name in $Names) { foreach ($name in $Names) {
if ($Force.IsPresent -or -not (Test-WingetPackage $name)) { if ($Force.IsPresent -or -not (Test-WingetPackage $name)) {
winget install ` winget install `