From 2af2a42a88893f4173796dc429d667d2fad71c1f Mon Sep 17 00:00:00 2001 From: Ross Goldberg <484615+rgoldberg@users.noreply.github.com> Date: Mon, 21 Oct 2024 07:42:30 -0400 Subject: [PATCH] Improve parameter names. Partial #592 Signed-off-by: Ross Goldberg <484615+rgoldberg@users.noreply.github.com> --- Sources/mas/Commands/Upgrade.swift | 6 +++--- Sources/mas/Controllers/MasStoreSearch.swift | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Sources/mas/Commands/Upgrade.swift b/Sources/mas/Commands/Upgrade.swift index db825b6..41054d2 100644 --- a/Sources/mas/Commands/Upgrade.swift +++ b/Sources/mas/Commands/Upgrade.swift @@ -58,14 +58,14 @@ extension Mas { let apps: [SoftwareProduct] = appIDs.isEmpty ? appLibrary.installedApps - : appIDs.compactMap { - if let appID = AppID($0) { + : appIDs.compactMap { appID in + if let appID = AppID(appID) { // argument is an AppID, lookup app by id using argument return appLibrary.installedApp(withAppID: appID) } // argument is not an AppID, lookup app by name using argument - return appLibrary.installedApp(named: $0) + return appLibrary.installedApp(named: appID) } let promises = apps.map { installedApp in diff --git a/Sources/mas/Controllers/MasStoreSearch.swift b/Sources/mas/Controllers/MasStoreSearch.swift index a2cf5b2..2dc7ff4 100644 --- a/Sources/mas/Controllers/MasStoreSearch.swift +++ b/Sources/mas/Controllers/MasStoreSearch.swift @@ -36,7 +36,7 @@ class MasStoreSearch: StoreSearch { /// /// - Parameter searchTerm: a search term matched against app names /// - Returns: A Promise of an Array of SearchResults matching searchTerm - func search(for appName: String) -> Promise<[SearchResult]> { + func search(for searchTerm: String) -> Promise<[SearchResult]> { // Search for apps for compatible platforms, in order of preference. // Macs with Apple Silicon can run iPad and iPhone apps. var entities = [Entity.desktopSoftware] @@ -45,8 +45,8 @@ class MasStoreSearch: StoreSearch { } let results = entities.map { entity in - guard let url = searchURL(for: appName, inCountry: country, ofEntity: entity) else { - fatalError("Failed to build URL for \(appName)") + guard let url = searchURL(for: searchTerm, inCountry: country, ofEntity: entity) else { + fatalError("Failed to build URL for \(searchTerm)") } return loadSearchResults(url) }