Add a function for checking winget packages

This commit is contained in:
Manuel Thalmann 2024-08-07 13:18:29 +02:00
parent 69093de8f6
commit ad513290b9

View file

@ -43,6 +43,22 @@ function Test-ChocoPackage {
-not [string]::IsNullOrEmpty((choco list --limit-output --exact $name));
}
<#
.SYNOPSIS
Checks whether a `winget` package with the specified id is installed.
.PARAMETER ID
The id of the package to check.
#>
function Test-WingetPackage {
[OutputType([bool])]
param(
[string] $ID
)
-not (& { $null = winget list --accept-source-agreements -e --id $ID; $?; });
}
<#
.SYNOPSIS
Checks whether a command with the specified name exists.