Merge pull request #571 from Romanitho/Wildcard

Add support for wildcard in app ID
pull/577/head
Romain 2024-02-23 00:35:26 +01:00 committed by GitHub
commit 9796b85dff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 27 additions and 19 deletions

View File

@ -29,7 +29,7 @@ Add (or remove) the apps' ID you want to disable autoupdate to 'excluded_apps.tx
- #### Or AllowList - #### Or AllowList
You can update only pre-selected apps. To do so, create an "included_apps.txt" with the apps' ID of the apps you want to auto-update and run the `Winget-AutoUpdate-Install.ps1` with `-UseWhiteList` parameter. Related post: https://github.com/Romanitho/Winget-AutoUpdate/issues/36 You can update only pre-selected apps. To do so, create an "included_apps.txt" with the apps' ID of the apps you want to auto-update and run the `Winget-AutoUpdate-Install.ps1` with `-UseWhiteList` parameter. Related post: https://github.com/Romanitho/Winget-AutoUpdate/issues/36
> You can use WiGui to create these lists: https://github.com/Romanitho/Winget-Install-GUI > The lists can contain Wildcard (*). For instance ```Mozilla.Firefox*``` will take care of all Firefox channels. (From v1.19.2-7)
### Notification Level ### Notification Level
You can choose which notification will be displayed: Full, Success only or none. Use `-NotificationLevel` parameter when you run `Winget-AutoUpdate-Install.ps1`. You can choose which notification will be displayed: Full, Success only or none. Use `-NotificationLevel` parameter when you run `Winget-AutoUpdate-Install.ps1`.

View File

@ -292,14 +292,20 @@ if (Test-Network) {
if ($UseWhiteList) { if ($UseWhiteList) {
#For each app, notify and update #For each app, notify and update
foreach ($app in $outdated) { foreach ($app in $outdated) {
if (($toUpdate -contains $app.Id) -and $($app.Version) -ne "Unknown") { #if current app version is unknown, skip it
Update-App $app if ($($app.Version) -eq "Unknown") {
}
#if current app version is unknown
elseif ($($app.Version) -eq "Unknown") {
Write-ToLog "$($app.Name) : Skipped upgrade because current version is 'Unknown'" "Gray" Write-ToLog "$($app.Name) : Skipped upgrade because current version is 'Unknown'" "Gray"
} }
#if app is in "excluded list" #if app is in "include list", update it
elseif ($toUpdate -contains $app.Id) {
Update-App $app
}
#if app with wildcard is in "include list", update it
elseif ($toUpdate | Where-Object { $app.Id -like $_ }) {
Write-ToLog "$($app.Name) is wildcard in the include list."
Update-App $app
}
#else, skip it
else { else {
Write-ToLog "$($app.Name) : Skipped upgrade because it is not in the included app list" "Gray" Write-ToLog "$($app.Name) : Skipped upgrade because it is not in the included app list" "Gray"
} }
@ -309,17 +315,22 @@ if (Test-Network) {
else { else {
#For each app, notify and update #For each app, notify and update
foreach ($app in $outdated) { foreach ($app in $outdated) {
if (-not ($toSkip -contains $app.Id) -and $($app.Version) -ne "Unknown") { #if current app version is unknown, skip it
Update-App $app if ($($app.Version) -eq "Unknown") {
}
#if current app version is unknown
elseif ($($app.Version) -eq "Unknown") {
Write-ToLog "$($app.Name) : Skipped upgrade because current version is 'Unknown'" "Gray" Write-ToLog "$($app.Name) : Skipped upgrade because current version is 'Unknown'" "Gray"
} }
#if app is in "excluded list" #if app is in "excluded list", skip it
else { elseif ($toSkip -contains $app.Id) {
Write-ToLog "$($app.Name) : Skipped upgrade because it is in the excluded app list" "Gray" Write-ToLog "$($app.Name) : Skipped upgrade because it is in the excluded app list" "Gray"
} }
#if app with wildcard is in "excluded list", skip it
elseif ($toSkip | Where-Object { $app.Id -like $_ }) {
Write-ToLog "$($app.Name) : Skipped upgrade because it is *wildcard* in the excluded app list" "Gray"
}
# else, update it
else {
Update-App $app
}
} }
} }

View File

@ -5,8 +5,5 @@ Microsoft.Office
Microsoft.OneDrive Microsoft.OneDrive
Microsoft.Teams Microsoft.Teams
Microsoft.Teams.Classic Microsoft.Teams.Classic
Mozilla.Firefox Mozilla.Firefox*
Mozilla.Firefox.DeveloperEdition TeamViewer.TeamViewer*
Mozilla.Firefox.ESR
TeamViewer.TeamViewer
TeamViewer.TeamViewer.Host