Enhance the winget
install check
This commit is contained in:
parent
0b28364280
commit
7177fa97ca
|
@ -65,7 +65,7 @@ $null = New-Module {
|
|||
Install-Module -AcceptLicense -Force PSWindowsUpdate;
|
||||
};
|
||||
|
||||
if (-not (Test-Command winget)) {
|
||||
if (-not (Test-Winget)) {
|
||||
. "$PSScriptRoot/../Software/winget/Manage.ps1";
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -57,6 +57,17 @@ function Test-Command {
|
|||
[bool] (Get-Command $Name -ErrorAction SilentlyContinue);
|
||||
}
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Checks whether `winget` is working properly.
|
||||
#>
|
||||
function Test-Winget {
|
||||
(Test-Command winget) -and -not (
|
||||
[System.Linq.Enumerable]::Any(
|
||||
[string[]](winget source update winget),
|
||||
[System.Func[string,bool]]{ param($line) $line -eq "Cancelled"; }));
|
||||
}
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Checks whether a package with the specified name is installed.
|
||||
|
|
Loading…
Reference in a new issue