Improve winget function
This commit is contained in:
parent
e29e36acf7
commit
ddfbe17a49
1 changed files with 7 additions and 1 deletions
|
@ -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 `
|
||||||
|
|
Loading…
Reference in a new issue